bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: value of dangling pointer


From: Marcus Brinkmann
Subject: Re: value of dangling pointer
Date: Wed, 1 Aug 2001 14:59:48 +0200
User-agent: Mutt/1.3.18i

On Wed, Aug 01, 2001 at 01:47:27AM +0300, Kalle Olavi Niemitalo wrote:
> hostmux/mux.c (free_name) does this:
> 
>   free ((char *)nm->name);
>   if (nm->name != nm->canon)
>     free ((char *)nm->canon);

I have checked in the below fix.  If you find more like these, please report
them.  (Also stuff like p = malloc(...); q = realloc(p...); if (p == q)...)

BTW, the function name in the diff is bogus (diff -p has a bug).

Marcus

Index: ChangeLog
===================================================================
RCS file: /home/cvs/hurd/hostmux/ChangeLog,v
retrieving revision 1.13
diff -u -p -r1.13 ChangeLog
--- ChangeLog   2001/02/12 22:18:55     1.13
+++ ChangeLog   2001/08/01 12:58:15
@@ -1,3 +1,8 @@
+2001-08-01  Marcus Brinkmann  <marcus@gnu.org>
+
+       * mux.c (free_name): Swap order of memory releases.
+       Reported by Kalle Olavi Niemitalo <kon@iki.fi>
+
 2001-02-12  Marcus Brinkmann  <marcus@gnu.org>
 
        * hostmux.c: Include <version.h>.  Add global variable
Index: mux.c
===================================================================
RCS file: /home/cvs/hurd/hostmux/mux.c,v
retrieving revision 1.6
diff -u -p -r1.6 mux.c
--- mux.c       1999/07/11 19:40:34     1.6
+++ mux.c       2001/08/01 12:58:16
@@ -218,9 +218,9 @@ netfs_get_dirents (struct iouser *cred, 
 static void
 free_name (struct hostmux_name *nm)
 {
-  free ((char *)nm->name);
   if (nm->name != nm->canon)
     free ((char *)nm->canon);
+  free ((char *)nm->name);
   free (nm);
 }
 

-- 
`Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org
Marcus Brinkmann              GNU    http://www.gnu.org    marcus@gnu.org
Marcus.Brinkmann@ruhr-uni-bochum.de
http://www.marcus-brinkmann.de



reply via email to

[Prev in Thread] Current Thread [Next in Thread]