Description: Fix memory leak
authorviric <viriketo@gmail.com>
Sun, 20 Mar 2016 11:25:10 +0100
changeset 343 23242cea443d
parent 342 62836c26026d
child 344 9be22a4aa695
Description: Fix memory leak Author: Alexander Inyukhin <shurick@sectorb.msk.ru> Last-Update: 2012-06-29
error.c
--- a/error.c	Sat Mar 19 12:11:50 2016 +0100
+++ b/error.c	Sun Mar 20 11:25:10 2016 +0100
@@ -74,12 +74,16 @@
 
     fd = open(new_path, O_CREAT | O_APPEND | O_WRONLY, 0600);
     if (fd == -1)
+    {
+        free(new_path);
         return 0;
+    }
 
     out = fdopen(fd, "a");
     if (out == NULL)
     {
         close(fd);
+        free(new_path);
         return 0;
     }