Skip to contentSkip to conversation

trace-cmd: Fix plist allocation check in trace-msg.c

PATCH New Steven Rostedt 1 participant 1 message Feb 3, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trace-cmd: Fix plist allocation check in trace-msg.c

From: "Steven Rostedt (VMware)" <[email protected]>

The plist allocation check in get_trace_req_protos() returns error on a successful allocation. Fix it.

---
 lib/trace-cmd/trace-msg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/trace-cmd/trace-msg.c +1 -1
index 8d2ed38d..611af2c1 100644
@@ -981,7 +981,7 @@ static int get_trace_req_protos(char *buf, int length,
 	}
 
 	plist = calloc(1, sizeof(struct tracecmd_tsync_protos));
-	if (plist)
+	if (!plist)
 		goto error;
 	plist->names = calloc(count + 1, sizeof(char *));
 	if (!plist->names)
Signature · 1 line
2.25.4