]> 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>
Mon, 30 Apr 2018 10:18:23 +0000 (12:18 +0200)
Use after free

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

index 568e102b0404b6f49e474b3e64ba9c3b8a4f31bd..30efeaff854e6991b456573384425bb600b2d258 100644 (file)
@@ -1634,11 +1634,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");