diff options
author | Karel Zak | 2009-08-17 10:53:42 +0200 |
---|---|---|
committer | Karel Zak | 2009-08-17 10:56:05 +0200 |
commit | ebeafc50f3d8125bd77d601a26351b3eba3bc259 (patch) | |
tree | 6e4deee47f815b588b1bd35a9fd42a18e3b39317 /shlibs/blkid/src/verify.c | |
parent | libblkid: fix ext2 detection on systems with ext4 only (diff) | |
download | kernel-qcow2-util-linux-ebeafc50f3d8125bd77d601a26351b3eba3bc259.tar.gz kernel-qcow2-util-linux-ebeafc50f3d8125bd77d601a26351b3eba3bc259.tar.xz kernel-qcow2-util-linux-ebeafc50f3d8125bd77d601a26351b3eba3bc259.zip |
libblkid: fix cache->probe memory leak
Fixes:
* stupid bug, blkid_put_cache() does not deallocate the probe struct
* the cache->probe initialization in verify.c should be also more
robust
Reported-By: Jean-Pierre Demailly <Jean-Pierre.Demailly@ujf-grenoble.fr>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/blkid/src/verify.c')
-rw-r--r-- | shlibs/blkid/src/verify.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/shlibs/blkid/src/verify.c b/shlibs/blkid/src/verify.c index 40ab4c672..78dafe7e6 100644 --- a/shlibs/blkid/src/verify.c +++ b/shlibs/blkid/src/verify.c @@ -87,8 +87,13 @@ blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev) (unsigned long)st.st_mtime, (unsigned long)diff)); - if (!cache->probe) + if (!cache->probe) { cache->probe = blkid_new_probe(); + if (!cache->probe) { + blkid_free_dev(dev); + return NULL; + } + } fd = open(dev->bid_name, O_RDONLY); if (fd < 0) { |