[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Malloc patches, round 3
From: |
Igor Khavkine |
Subject: |
Re: Malloc patches, round 3 |
Date: |
Tue, 31 Jul 2001 19:14:55 -0400 |
User-agent: |
Mutt/1.3.18i |
On Wed, Aug 01, 2001 at 01:46:52AM +0300, Kalle Olavi Niemitalo wrote:
> 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.
Very good points. I'm taking all comments under consideration. Also
I will follow Roland's advice and roll a bigger diff, with more
changes of the same kind. But it will take me a bit longer to
come up with it.
Igor