Skip to contentSkip to conversation

xenstore: free resp in do_control_help

PATCH In review Wei Liu 2 participants 3 messages Mar 1, 2017

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH 1/2 xenstore: free resp in do_control_help

Coverity-ID: 1401603

---
Cc: Ian Jackson <[email protected]>
Cc: Juergen Gross <[email protected]>

---
 tools/xenstore/xenstored_control.c | 2 ++
 1 file changed, 2 insertions(+)
tools/xenstore/xenstored_control.c +2 -0
index 7c149117b1..d99b7eb7f9 100644
@@ -171,6 +171,8 @@ static int do_control_help(void *ctx, struct connection *conn,
 	resp[len] = 0;
 
 	send_reply(conn, XS_CONTROL, resp, len);
+
+	talloc_free(resp);
 	return 0;
 }
 
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw
Quoted 15 lines · Wei Liu

Coverity-ID: 1401603

---
Cc: Ian Jackson <[email protected]>
Cc: Juergen Gross <[email protected]>

---
 tools/xenstore/xenstored_control.c | 2 ++
 1 file changed, 2 insertions(+)
tools/xenstore/xenstored_control.c +0 -0
index 7c149117b1..d99b7eb7f9 100644

tools/xenstore/xenstored_control.c static int do_control_help(void *ctx, struct connection *conn, · line 175

Quoted 5 lines
tools/xenstore/xenstored_control.c +2 -0
@@ -171,6 +171,8 @@ static int do_control_help(void *ctx, struct connection *conn,
 	resp[len] = 0;
 
 	send_reply(conn, XS_CONTROL, resp, len);
+
+	talloc_free(resp);

Sorry, no. The context for the allocation is "in" which will be freed automatically.

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#2 lore raw
Quoted 18 lines · Juergen Gross
Quoted 17 lines · Wei Liu

Coverity-ID: 1401603

---
Cc: Ian Jackson <[email protected]>
Cc: Juergen Gross <[email protected]>

---
 tools/xenstore/xenstored_control.c | 2 ++
 1 file changed, 2 insertions(+)
tools/xenstore/xenstored_control.c +0 -0
index 7c149117b1..d99b7eb7f9 100644
@@ -171,6 +171,8 @@ static int do_control_help(void *ctx, struct connection *conn,
 	resp[len] = 0;
 
Quoted 7 lines

tools/xenstore/xenstored_control.c static int do_control_help(void *ctx, struct connection *conn, · line 175

Quoted 3 lines
tools/xenstore/xenstored_control.c +2 -0
 	send_reply(conn, XS_CONTROL, resp, len);
+
+	talloc_free(resp);

Sorry, no. The context for the allocation is "in" which will be freed automatically.

You're right. Coverity isn't smart enough to figure that out and I missed it used the passed in ctx.

Ignore this patch.

Wei.

Quoted 3 lines

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel