[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Malloc patches, round 3
From: |
Kalle Olavi Niemitalo |
Subject: |
Re: Malloc patches, round 3 |
Date: |
01 Aug 2001 01:46:52 +0300 |
Igor Khavkine <i_khavki@alcor.concordia.ca> writes:
> --- hurd.orig/ftpfs/node.c Wed Aug 6 18:08:35 1997
> +++ hurd/ftpfs/node.c Tue Jul 31 01:18:31 2001
> @@ -51,8 +51,10 @@
> nn->ncache_next = nn->ncache_prev = 0;
>
> new = netfs_make_node (nn);
> - if (! new)
> + if (!new || !nn->rmt_path)
> {
> + if (nn->rmt_path)
> + free (nn->rmt_path);
> free (nn);
> return ENOMEM;
> }
If nn->rmt_path==NULL and you free(nn), shouldn't you free(new)
as well? (netfs_nrele(new) would call netfs_node_norefs and thus
ihash_locp_remove even though ihash_add hasn't been called. Is
that safe?)
I think it would be clearest not to call netfs_make_node at all
if the rmt_path allocation fails.
BTW I would prefer diff --show-c-function.