This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: use of malloc



On Mon, Apr 24, Ulrich Drepper wrote:

> Thorsten Kukuk <kukuk@suse.de> writes:
> 
> > Uli, please look at the ChangeLog file. You have removed similar free's
> > in other parts of the NIS code.
> 
> In some of them.  But not the once where we terminated a function in
> the case we found an error != ENOMEM.  This happened in the function I
> changed together with the missing frees in the __nis_destroy_callback.
> This must have leaked quite a lot.

There was no leak. It was ok that strdup returns NULL, nothing
bad happens, but the other data could be enought for funcionality.
Your current patches for nis_callback doesn't show any new free,
so no memory leak fix from you there.

> 
> > And your new Code is wrong. You derefence NULL Pointer !!!!!
> 
> Where?

For example here:
--- nis_callback.c      1999/08/13 19:44:46     1.11
+++ nis_callback.c      2000/04/21 16:49:33     1.12
@@ -370,6 +402,11 @@
   svc_destroy (cb->xprt);
   close (cb->sock);
   xdr_free ((xdrproc_t) _xdr_nis_server, (char *) cb->serv);
+  free (cb->serv->ep.ep_val[0].uaddr);
+  free (cb->serv->ep.ep_val[0].proto);
+  free (cb->serv->ep.ep_val[0].family);
+  free (cb->serv->ep.ep_val);
+  free (cb->serv->name);
   free (cb->serv);


But as I can see from cvs, you have removed the code after my
email this morning (or you have checked in your new changes after my email
this morning).

> > Please remove it complete and don't change code, which you don't
> > understand in such a way.
> 
> Well, I understand enough to see that the functions are leaking a lot
> of memory during normal operation.

Why does mtrace doesn't find them ?

  Thorsten

-- 
Thorsten Kukuk       http://www.suse.de/~kukuk/       kukuk@suse.de
SuSE GmbH            Schanzaeckerstr. 10            90443 Nuernberg
Linux is like a Vorlon.  It is incredibly powerful, gives terse,
cryptic answers and has a lot of things going on in the background.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]