Fix some incorrect code (found by valgrind).
authorwmeier <wmeier@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 15 Aug 2008 13:05:20 +0000 (13:05 +0000)
committerwmeier <wmeier@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 15 Aug 2008 13:05:20 +0000 (13:05 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@26032 f5534014-38df-0310-8fa8-9805f1628bb7

capture.c

index ae121a5d372b259457604499d374cf674b1b87dd..14dab6573100645189c05333d96c9e17b0dad551 100644 (file)
--- a/capture.c
+++ b/capture.c
@@ -656,7 +656,8 @@ capture_input_closed(capture_options *capture_opts)
 /**
  * Fetch the interface list from a child process (dumpcap).
  *
- * @return A GList containing if_info_t structs if successful, NULL otherwise.
+ * @return A GList containing if_info_t structs if successful, NULL (with err and possibly err_str set) otherwise.
+ *
  */
 
 /* XXX - We parse simple text output to get our interface list.  Should
@@ -679,10 +680,7 @@ capture_interface_list(int *err, char **err_str)
     if (*err != 0) {
         g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Capture Interface List failed!");
         if (err_str) {
-            if (*err_str)
-                *err_str = msg;
-            else
-                g_free(msg);
+            *err_str = msg;
         } else {
             g_free(msg);
         }
@@ -744,9 +742,9 @@ capture_interface_list(int *err, char **err_str)
 
     /* Check to see if we built a list */
     if (if_list == NULL) {
-        if (err_str && *err_str)
-            *err_str = g_strdup("No interfaces found");
         *err = NO_INTERFACES_FOUND;
+        if (err_str)
+            *err_str = g_strdup("No interfaces found");
     }
     return if_list;
 }