From 4261109e1e15ec16b3d38df9e6011d676a558487 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Tue, 22 Jul 2014 11:51:15 -0700 Subject: Don't return an error string for NO_INTERFACES_FOUND. Most callers of capture_interface_list() don't expect an error string for NO_INTERFACES_FOUND, because that's not really an error, it's just a statement of face (and perhaps an error of 0 should be returned), so they don't bother freeing the error string, causing a leak. Instead, have the one place that *did* expect it to return an error string just put "No interfaces found" itself. Also, have that place not check for an error string if interfaces *were* found, as no error code or string is returned in that case. Change-Id: I9cb8ed7ad22810b23e2251d2833d9b7ab02eec03 Reviewed-on: https://code.wireshark.org/review/3165 Reviewed-by: Guy Harris --- capchild/capture_ifinfo.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'capchild') diff --git a/capchild/capture_ifinfo.c b/capchild/capture_ifinfo.c index 984fa664fe..94af1c0274 100644 --- a/capchild/capture_ifinfo.c +++ b/capchild/capture_ifinfo.c @@ -189,11 +189,8 @@ capture_interface_list(int *err, char **err_str, void (*update_cb)(void)) g_strfreev(raw_list); /* Check to see if we built a list */ - if (if_list == NULL) { + if (if_list == NULL) *err = NO_INTERFACES_FOUND; - if (err_str) - *err_str = g_strdup("No interfaces found"); - } #ifdef HAVE_PCAP_REMOTE if (remote_interface_list && g_list_length(remote_interface_list) > 0) { append_remote_list(if_list); -- cgit v1.2.3