]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commit
subst: Fix free of uninit pointers
authorEric Sandeen <sandeen@redhat.com>
Fri, 16 Sep 2011 20:49:29 +0000 (15:49 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 16 Sep 2011 22:43:05 +0000 (18:43 -0400)
commitd5c1d82ed8812a036846267a1720faec223c0ba0
tree3bb6e78a8a7d9cde6e18094860d099d0ae14fde0
parent624e8ebe3058bad9af6e719b7f9e7afab7d3fe30
subst: Fix free of uninit pointers

in add_subst(), if the malloc of ent->name fails, we goto fail;
which will free ent->name (which is null, so OK) but also free
ent->value (which is uninitialized).  There is no case where
we must free ent->value on an error (it is allocated last, and
if it fails it of course doesn't need to be freed) so just
remove it.

Also "retval" is only assigned once to the constant ENOMEM,
so we can just return that explicitly in the failure case.

Signed-off-by: Eric Saneeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
util/subst.c