From 05e6b06bc957c826f6d424fd56f308a3d545ea93 Mon Sep 17 00:00:00 2001 From: Simon Reinhardt Date: Thu, 15 Oct 2015 17:01:14 +0200 Subject: [PATCH] copy-file: On error, add missing call to free. --- lib/copy-file.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/copy-file.c b/lib/copy-file.c index da84c6c..b0cd850 100644 --- a/lib/copy-file.c +++ b/lib/copy-file.c @@ -101,6 +101,8 @@ qcopy_file_preserving (const char *src_filename, const char *dest_filename) } free (buf); + /* Set to NULL to avoid double-free below. */ + buf = NULL; #if !USE_ACL if (close (dest_fd) < 0) @@ -174,6 +176,7 @@ qcopy_file_preserving (const char *src_filename, const char *dest_filename) error_src: close (src_fd); error: + free (buf); return err; } -- 2.1.4