[VALGRIND] Fix memory leak in libblkid (blkid_get_devname)

Nyah, nyah, Coverity didn't find this one.  :-)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
bitmap-optimize
Theodore Ts'o 2007-03-21 17:15:36 -04:00
parent 61bf36ef2d
commit 5f7fe7fe0e
2 changed files with 11 additions and 5 deletions

View File

@ -1,3 +1,7 @@
2007-03-21 Theodore Tso <tytso@mit.edu>
* resolve.c (blkid_get_devname): Fix memory leak.
2007-03-18 Theodore Tso <tytso@mit.edu>
* tag.c (blkid_dev_has_tag): Allow value to be NULL, in which case

View File

@ -79,22 +79,24 @@ char *blkid_get_devname(blkid_cache cache, const char *token,
value ? value : "", cache ? "in cache" : "from disk"));
if (!value) {
if (!strchr(token, '='))
return blkid_strdup(token);
if (!strchr(token, '=')) {
ret = blkid_strdup(token);
goto out;
}
blkid_parse_tag_string(token, &t, &v);
if (!t || !v)
goto errout;
goto out;
token = t;
value = v;
}
dev = blkid_find_dev_with_tag(c, token, value);
if (!dev)
goto errout;
goto out;
ret = blkid_strdup(blkid_dev_devname(dev));
errout:
out:
if (t)
free(t);
if (v)