summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2018-03-17 17:40:01 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2018-03-17 17:40:01 +0100
commitd6d5654de516eeff3d20fd1dc744825fd3d32bd4 (patch)
treead23a89e3af1835a1d127e14528ca5a5e6eb3474
parent20f1c4c1a8df0b8b98851c1cee7ae7f84b2be11c (diff)
Fix memory leak if getwd(".") failed
-rw-r--r--src/dir.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/dir.c b/src/dir.c
index 7122d28..29048be 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, &copy_ok, &copy_bad);