fixing coverity 10464: Resource leak
authorMatthias Wachs <wachs@net.in.tum.de>
Tue, 25 Jun 2013 11:12:49 +0000 (11:12 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Tue, 25 Jun 2013 11:12:49 +0000 (11:12 +0000)
src/transport/test_plugin_transport.c

index 8dde5c10b62663e07cc1d2b0a97237ea722a2fe7..d2d03daa7b37b9dd89ff6a1d6378086b3866c356 100644 (file)
@@ -565,6 +565,9 @@ run (void *cls, char *const *args, const char *cfgfile,
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                   "Hostkey `%s' missing.  Exiting.\n",
                   HOSTKEY_FILE);
+      GNUNET_free (keyfile);
+      end_badly_now ();
+      return;
   }
 
   if (GNUNET_OK != GNUNET_DISK_directory_create_for_file (keyfile))
@@ -572,6 +575,7 @@ run (void *cls, char *const *args, const char *cfgfile,
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                   "Could not create a directory for hostkey `%s'.  Exiting.\n",
                   keyfile);
+      GNUNET_free (keyfile);
       end_badly_now ();
       return;
   }
@@ -581,6 +585,7 @@ run (void *cls, char *const *args, const char *cfgfile,
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                   "Could not copy hostkey `%s' to destination `%s'.  Exiting.\n",
                   HOSTKEY_FILE, keyfile);
+      GNUNET_free (keyfile);
       end_badly_now ();
       return;
   }