]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
coverity: #1435263
authorChristian Brauner <christian.brauner@ubuntu.com>
Mon, 30 Apr 2018 10:18:23 +0000 (12:18 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 23 Aug 2018 20:59:23 +0000 (22:59 +0200)
Use after free

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/lxccontainer.c

index 8356d8d2c2daff204d1e0f706e5648ef4a8b8985..478c7924bb7e65c9226c62dda82b5519ee8c8b99 100644 (file)
@@ -1534,11 +1534,12 @@ static bool prepend_lxc_header(char *path, const char *t, char *const argv[])
        }
 
        ret = sha1sum_file(tpath, md_value);
-       free(tpath);
        if (ret < 0) {
                ERROR("Failed to get sha1sum of %s", tpath);
+               free(tpath);
                goto out_free_contents;
        }
+       free(tpath);
 #endif
 
        f = fopen(path, "w");