From: Karel Zak Date: Wed, 4 Jan 2023 11:57:03 +0000 (+0100) Subject: libmount: fix possible double free X-Git-Tag: v2.39-rc1~212 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=ab74f107f5f1d518d6114566ca46877ac6f746ca;p=thirdparty%2Futil-linux.git libmount: fix possible double free Signed-off-by: Karel Zak --- diff --git a/libmount/src/optstr.c b/libmount/src/optstr.c index 0392fe5e8a..cfac346fe1 100644 --- a/libmount/src/optstr.c +++ b/libmount/src/optstr.c @@ -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;