[PATCH 2/3] discover: Release process resources on error

Sam Mendoza-Jonas sam at mendozajonas.com
Tue Feb 9 13:08:44 AEDT 2016


From: Samuel Mendoza-Jonas <sam.mj at au1.ibm.com>

Fixes Coverity defect #30472

Signed-off-by: Sam Mendoza-Jonas <sam at mendozajonas.com>
---
 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 5df0700..0b456a9 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.7.1



More information about the Petitboot mailing list