From 96e59eee66a474de95ed2fac5a975d8a3c254d1a Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sat, 8 Dec 2012 15:50:05 +0000 Subject: [PATCH] lib: 'tmpfile' is never NULL (found by Coverity). --- src/file.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/file.c b/src/file.c index 5b86b2747..9f153a6e0 100644 --- a/src/file.c +++ b/src/file.c @@ -329,7 +329,7 @@ write_or_append (guestfs_h *g, const char *path, const char *content, size_t size, int append) { - char *tmpfile = NULL; + char *tmpfile; int fd = -1; int64_t filesize; @@ -381,10 +381,8 @@ write_or_append (guestfs_h *g, const char *path, err: if (fd >= 0) close (fd); - if (tmpfile) { - unlink (tmpfile); - free (tmpfile); - } + unlink (tmpfile); + free (tmpfile); return -1; }