]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
Fix memory leak in blkid library
authorTheodore Ts'o <tytso@mit.edu>
Wed, 7 Mar 2007 00:56:18 +0000 (19:56 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 7 Mar 2007 00:56:18 +0000 (19:56 -0500)
Addresses Debian Bug: #413661

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/blkid/ChangeLog
lib/blkid/devname.c
lib/blkid/probe.c

index b0a8098d8fd2a6e240ead276f03edb60c41c1fb8..a0890a2a2913706f7c79c7ab88984bd87eec934b 100644 (file)
@@ -1,3 +1,8 @@
+2007-03-06  Theodore Tso  <tytso@mit.edu>
+
+       * devname.c (dm_probe_all), probe.c (blkid_verify): Fix memory
+               leak.  (Addresses Debian Bug #413661)
+
 2006-09-24  Theodore Tso  <tytso@mit.edu>
 
        * devno.c (scan_dir): Don't follow symlinks when recursively
index f8f5f48c90459fd87c416f1b94b01cc365e3ac2c..13500768e25722453fd49c1fd4d20e0733982a78 100644 (file)
@@ -305,6 +305,7 @@ static void dm_probe_all(blkid_cache cache, int only_if_new)
                probe_one(cache, device, dev, BLKID_PRI_DM, only_if_new);
 
 try_next:
+               free(device);
                next = names->next;
        } while (next);
 
index 0f16565a247a657945add5d9689906558d7f638b..24592bf3bba0ee06b1f6dae161f3d1bba25da329 100644 (file)
@@ -886,9 +886,9 @@ try_again:
        }
 
        if (!dev->bid_type) {
-               if (probe.fd >= 0) close(probe.fd);
                blkid_free_dev(dev);
-               return NULL;
+               dev = 0;
+               goto found_type;
        }
                
 found_type:
@@ -908,7 +908,8 @@ found_type:
                free(probe.sbbuf);
        if (probe.buf)
                free(probe.buf);
-       close(probe.fd);
+       if (probe.fd >= 0) 
+               close(probe.fd);
 
        return dev;
 }