From 5f339d4485e450adac994c190bfafb45734bcae9 Mon Sep 17 00:00:00 2001 From: Samuel Mendoza-Jonas Date: Fri, 18 Dec 2015 14:00:49 +1100 Subject: [PATCH] discover: Release process resources on error Fixes Coverity defect #30472 Signed-off-by: Sam Mendoza-Jonas --- discover/device-handler.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/discover/device-handler.c b/discover/device-handler.c index 77f9e3c..9de2a19 100644 --- a/discover/device-handler.c +++ b/discover/device-handler.c @@ -1099,10 +1099,12 @@ static char *device_from_addr(void *ctx, struct pb_url *url) rc = process_run_sync(p); - if (rc) { + if (rc || p->exit_status) { /* ip has complained for some reason; most likely * there is no route to the host - bail out */ - pb_debug("%s: No route to %s\n",__func__,url->host); + pb_debug("%s: `ip` returns non-zero exit status\n", __func__); + pb_debug("ip buf: %s\n", p->stdout_buf); + process_release(p); return NULL; } -- 2.39.2