Fix memory leak in blkid library

Addresses Debian Bug: #413661

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
bitmap-optimize
Theodore Ts'o 2007-03-06 19:56:18 -05:00
parent a178852877
commit 257ace82b7
3 changed files with 10 additions and 3 deletions

View 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

View 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);

View 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;
}