From d6d5654de516eeff3d20fd1dc744825fd3d32bd4 Mon Sep 17 00:00:00 2001 From: Christophe Grenier Date: Sat, 17 Mar 2018 17:40:01 +0100 Subject: [PATCH] Fix memory leak if getwd(".") failed --- src/dir.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/dir.c b/src/dir.c index 7122d28d..29048bee 100644 --- a/src/dir.c +++ b/src/dir.c @@ -372,7 +372,10 @@ void dir_whole_partition_copy(disk_t *disk, const partition_t *partition, dir_da dst_directory[1]='\0'; #ifdef HAVE_GETCWD if(getcwd(dst_directory, 4096)==NULL) + { + free(dst_directory); return ; + } #endif dir_data->local_dir=dst_directory; dir_whole_partition_copy_aux(disk, partition, dir_data, inode, ©_ok, ©_bad);