[PATCH] opal: prd_info: NULLify output after free

Colin King colin.king at canonical.com
Fri Apr 21 10:04:04 UTC 2017


From: Colin Ian King <colin.king at canonical.com>

This fixes a static analysis warning.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/opal/prd_info.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/opal/prd_info.c b/src/opal/prd_info.c
index 04e0f4aa..bbaac408 100644
--- a/src/opal/prd_info.c
+++ b/src/opal/prd_info.c
@@ -80,8 +80,10 @@ static int prd_service_check(fwts_framework *fw, int *restart)
 	command = "systemctl status opal-prd.service 2>&1";
 	status = fwts_exec2(command, &output);
 
-	if (output)
+	if (output) {
 		free(output);
+		output = NULL;
+	}
 
 	switch (status) {
 	case -1: /* status when nothing was successful */
-- 
2.11.0




More information about the fwts-devel mailing list