Do not leak memory.
authorMartin Schlemmer <azarah@gentoo.org>
Wed, 14 Sep 2005 13:35:08 +0000 (13:35 +0000)
committerMartin Schlemmer <azarah@gentoo.org>
Wed, 14 Sep 2005 13:35:08 +0000 (13:35 +0000)
Package-Manager: portage-2.0.52-r1

sys-apps/util-linux/ChangeLog
sys-apps/util-linux/Manifest
sys-apps/util-linux/files/util-linux-2.12q-update_mtab-fixes.patch

index 53798cd316687915973d96481422934c84993a84..858b6b92138a6c0019d3be05606d5bf8149c8a4c 100644 (file)
@@ -1,6 +1,10 @@
 # ChangeLog for sys-apps/util-linux
 # Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/util-linux/ChangeLog,v 1.113 2005/09/14 09:15:35 azarah Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/util-linux/ChangeLog,v 1.114 2005/09/14 13:35:08 azarah Exp $
+
+  14 Sep 2005; Martin Schlemmer <azarah@gentoo.org>
+  files/util-linux-2.12q-update_mtab-fixes.patch:
+  Do not leak memory.
 
   14 Sep 2005; Martin Schlemmer <azarah@gentoo.org>
   files/util-linux-2.12q-update-mtab-when-moving.patch:
index ece6649232073cce8dd5b5c997b8e04829184221..fb32ae03fbda6ec4727e4ea1a08c989f6d80b4e0 100644 (file)
@@ -2,7 +2,7 @@
 Hash: SHA1
 
 MD5 5497e9050dc8cde95a0e015edcd59c81 util-linux-2.12i-r1.ebuild 3960
-MD5 526225599dc07676b3820c84c7bb87b9 ChangeLog 19439
+MD5 291cd07459b6632241f2d0563827aa07 ChangeLog 19564
 MD5 42a00cdd523f8facea7f10a9f4df86a1 util-linux-2.12q-r2.ebuild 5692
 MD5 9a09f8d531c582e78977dbfd96edc1f2 metadata.xml 164
 MD5 40353e338343ed2b6a8f23259c881e49 util-linux-2.12q.ebuild 4785
@@ -28,7 +28,7 @@ MD5 28b1a8ed38823851eafadacef8ce11ec files/util-linux-2.12q-no-m68k-fdisk.patch
 MD5 a33ff00c09f558d4273360a581880c23 files/digest-util-linux-2.12q-r2 292
 MD5 18371db840b08f5782e3f8f96c4efe8d files/util-linux-2.11z-pic.patch 3056
 MD5 7ce604460c5607e6eb5d894b6c8b2064 files/util-linux-2.12-fat-LABEL-support.patch 11583
-MD5 e62aa4a3faeb981c042f762d6ffe5743 files/util-linux-2.12q-update_mtab-fixes.patch 2281
+MD5 f182d2c3c90cdc74c816a4656a8f3bbf files/util-linux-2.12q-update_mtab-fixes.patch 2636
 MD5 b360252f16d707f668b605d7a2abb791 files/util-linux-2.12q-dont-umask.patch 439
 MD5 cfa3960fd97ca16c85b0d1b87e6ba226 files/digest-util-linux-2.12i-r1 156
 MD5 61beee95fb4696a6af11ffb84ddb055c files/util-linux-2.12i-ignore-managed.patch 506
@@ -40,7 +40,7 @@ MD5 d20405e12353610b3ef8fbc2e1d57f2a files/crypto-loop.initd 1625
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.2 (GNU/Linux)
 
-iD8DBQFDJ+qL1ZcsMnZjRyIRAjdJAKCS8ZuOu/0cS+1KKsAH0Zhv9fwRbwCguMYk
-+G+gKy9qUTIrlQQkMZS+nuw=
-=lelx
+iD8DBQFDKCdm1ZcsMnZjRyIRAjsjAJ4i5o1w/hOLItfLoF1OKqaE9AYNUACfZ3ly
+AgqMOKsD3ZyVt61PXCvCLlU=
+=I0ra
 -----END PGP SIGNATURE-----
index 15969461f2f0088bbb4ac94ba0fcfe6f8374341a..7e1c9db6bf86509072f8cf40b3116415e5ba783f 100644 (file)
@@ -13,19 +13,22 @@ This fixes a few issues with update_mtab():
   mtab.
 - If mtab is empty, absent->prev should be set to mc0, and not mc0->prev, as
   it will be NULL.
+- Memory leak if we have to abort before mc0 and co are freed.
 
-Patch by Martin Schlemmer <azarah@gentoo.za.org>
+Patch by Martin Schlemmer <azarah@gentoo.org>
 
 
---- util-linux-2.12q/mount/fstab.c     2005-09-14 08:22:34.000000000 +0200
-+++ util-linux-2.12q.az/mount/fstab.c  2005-09-14 10:37:54.000000000 +0200
-@@ -604,15 +604,30 @@ update_mtab (const char *dir, struct my_
+--- util-linux-2.12q/mount/fstab.c     2005-09-14 15:30:10.000000000 +0200
++++ util-linux-2.12q.az/mount/fstab.c  2005-09-14 15:31:48.000000000 +0200
+@@ -604,15 +604,32 @@ update_mtab (const char *dir, struct my_
                                free(mc);
                        }
                } else {
 -                      /* A remount */
 -                      mc->m.mnt_opts = instead->mnt_opts;
-+                      /* A remount.  Need to alloc memory, else we might
++                      /* A remount. */
++                      my_free(mc->m.mnt_opts);
++                      /* Need to alloc memory, else we might
 +                       * run into issues if both we and the caller frees
 +                       * mnt_opts ... */
 +                      mc->m.mnt_opts = xstrdup(instead->mnt_opts);
@@ -54,3 +57,12 @@ Patch by Martin Schlemmer <azarah@gentoo.za.org>
                mc0->prev = absent;
                if (mc0->nxt == NULL)
                        mc0->nxt = absent;
+@@ -624,6 +641,8 @@ update_mtab (const char *dir, struct my_
+               int errsv = errno;
+               error (_("cannot open %s (%s) - mtab not updated"),
+                      MOUNTED_TEMP, strerror (errsv));
++              /* Do not leak memory */
++              discard_mntentchn(mc0);
+               goto leave;
+       }
+