]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: fix possible double free
authorKarel Zak <kzak@redhat.com>
Wed, 4 Jan 2023 11:57:03 +0000 (12:57 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 4 Jan 2023 11:57:03 +0000 (12:57 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/optstr.c

index 0392fe5e8af73d6c6f3a2b262992b29994856df2..cfac346fe1ba86503cd6d7df1d389e0d50fe48cc 100644 (file)
@@ -148,7 +148,7 @@ int mnt_optstr_append_option(char **optstr, const char *name, const char *value)
        rc = mnt_buffer_append_option(&buf, name, nsz, value, vsz);
        if (!rc)
                *optstr = ul_buffer_get_data(&buf, NULL, NULL);
-       else
+       else if (osz == 0)
                ul_buffer_free_data(&buf);
 
        return rc;