summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Golle2021-08-23 17:04:55 +0000
committerDaniel Golle2021-08-24 17:31:51 +0000
commitf6daca3bf4aee7874f2a2b05b5b82d5fdf35e6a4 (patch)
tree84a5955918dc267b0dddf91bfcb353f17310acf7
parent6010bd3e126717ef8e16a83d5b489aea42de889d (diff)
downloadprocd-f6daca3bf4aee7874f2a2b05b5b82d5fdf35e6a4.tar.gz
uxc: free string returned by blobmsg_format_json_indent()
Coverity ID: 1490068 Resource leak Signed-off-by: Daniel Golle <daniel@makrotopia.org>
-rw-r--r--uxc.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/uxc.c b/uxc.c
index 7221763..3af4fa9 100644
--- a/uxc.c
+++ b/uxc.c
@@ -361,6 +361,7 @@ static int uxc_state(char *name)
char *bundle = NULL;
char *jail_name = NULL;
char *state = NULL;
+ char *tmp;
static struct blob_buf buf;
if (s)
@@ -401,7 +402,15 @@ static int uxc_state(char *name)
blobmsg_add_string(&buf, "status", s?"stopped":"uninitialized");
blobmsg_add_string(&buf, "bundle", bundle);
- printf("%s\n", blobmsg_format_json_indent(buf.head, true, 0));
+ tmp = blobmsg_format_json_indent(buf.head, true, 0);
+ if (!tmp) {
+ blob_buf_free(&buf);
+ return ENOMEM;
+ }
+
+ printf("%s\n", tmp);
+ free(tmp);
+
blob_buf_free(&buf);
return 0;