]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: variable dereferenced before check [smatch scan]
authorKarel Zak <kzak@redhat.com>
Wed, 5 Aug 2015 10:46:56 +0000 (12:46 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 5 Aug 2015 10:46:56 +0000 (12:46 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/optstr.c

index a729695f110c5ea5040ef1efe67496deb505009d..6593c1abe410758ead637834a44c405645297795 100644 (file)
@@ -247,13 +247,14 @@ int mnt_optstr_append_option(char **optstr, const char *name, const char *value)
 int mnt_optstr_prepend_option(char **optstr, const char *name, const char *value)
 {
        int rc = 0;
-       char *tmp = *optstr;
+       char *tmp;
 
        if (!optstr)
                return -EINVAL;
        if (!name || !*name)
                return 0;
 
+       *tmp = *optstr;
        *optstr = NULL;
 
        rc = mnt_optstr_append_option(optstr, name, value);