From cef701ede302a70f52bb1951f2dec2c0f88c2e5f Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Mon, 30 Apr 2018 12:18:23 +0200 Subject: [PATCH] coverity: #1435263 Use after free Signed-off-by: Christian Brauner --- src/lxc/lxccontainer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c index 568e102b0..30efeaff8 100644 --- a/src/lxc/lxccontainer.c +++ b/src/lxc/lxccontainer.c @@ -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"); -- 2.47.2