]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix the memory leak in `warn_if_option_path_is_relative()`.
authorYawning Angel <yawning@schwanenlied.me>
Mon, 6 Apr 2015 17:53:01 +0000 (17:53 +0000)
committerYawning Angel <yawning@schwanenlied.me>
Mon, 6 Apr 2015 17:53:01 +0000 (17:53 +0000)
Fixes coverity defect CID 1293337, not in any released version of tor.

src/or/config.c

index d65d35dfc2d6599f58ad61137c5dc4c5d861f9f3..00de0b99b0ee8c20d4c41b38207e7d264489821a 100644 (file)
@@ -2558,10 +2558,12 @@ static void
 warn_if_option_path_is_relative(const char *option,
                                 char *filepath)
 {
-  if (filepath &&path_is_relative(filepath))
+  if (filepath && path_is_relative(filepath)) {
+    char *abs_path = make_path_absolute(filepath);
     COMPLAIN("Path for %s (%s) is relative and will resolve to %s."
-             " Is this what you wanted?",option,filepath,
-             make_path_absolute(filepath));
+             " Is this what you wanted?", option, filepath, abs_path);
+    tor_free(abs_path);
+  }
 }
 
 /** Scan <b>options</b> for occurances of relative file/directory