>  The original is correct.  However, in libdiskfs/io-restrict-auth.c USER, which
> is equivalent to NEW_USER, is duplicated.  Should the libnetfs implementation
> also duplicate NEW_USER so it can be free'd?

Thanks for catching this.  The libdiskfs implementation looks wrong.
Here is a patch:

2002-04-02  Neal H Walfield  <[EMAIL PROTECTED]>

        * io-restrict-auth.c (diskfs_S_io_restrict_auth): When checking
        the result of a function, be sure to first save the result.
        Only free USER if there was an error.


Index: io-restrict-auth.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libdiskfs/io-restrict-auth.c,v
retrieving revision 1.12
diff -u -p -r1.12 io-restrict-auth.c
--- io-restrict-auth.c  16 Jun 2001 20:23:09 -0000      1.12
+++ io-restrict-auth.c  2 Apr 2002 15:13:40 -0000
@@ -1,5 +1,5 @@
 /* 
-   Copyright (C) 1994,95,96,2001 Free Software Foundation
+   Copyright (C) 1994,95,96,2001,02 Free Software Foundation
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -79,7 +79,7 @@ diskfs_S_io_restrict_auth (struct protid
       for (i = 0; i < cred->user->gids->num; i++)
        if (listmember (gids, cred->user->gids->ids[i], ngids))
          {
-           idvec_add (gvec, cred->user->gids->ids[i]);
+           err = idvec_add (gvec, cred->user->gids->ids[i]);
            if (err)
              goto out;
          }
@@ -103,8 +103,11 @@ diskfs_S_io_restrict_auth (struct protid
       *newportpoly = MACH_MSG_TYPE_MAKE_SEND;
       ports_port_deref (newpi);
     }
+
   mutex_unlock (&cred->po->np->lock);
 
-  iohelp_free_iouser (user);
+  if (err)
+    iohelp_free_iouser (user);
+
   return err;
 }

Roland: okay to apply this?


_______________________________________________
Bug-hurd mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-hurd

Reply via email to