Browse Source

uxc: fix segfault caused by use-after-free

Don't free blob_buf which was sent via ubus.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Daniel Golle 2 years ago
parent
commit
97bcdcf107
1 changed files with 1 additions and 1 deletions
  1. 1 1
      uxc.c

+ 1 - 1
uxc.c

@@ -586,12 +586,12 @@ static int uxc_create(char *name, bool immediately)
 	ret = 0;
 	if (ubus_lookup_id(ctx, "container", &id) ||
 		ubus_invoke(ctx, id, "add", req.head, NULL, NULL, 3000)) {
+		blob_buf_free(&req);
 		ret = EIO;
 	}
 
 	free(jailname);
 	free(path);
-	blob_buf_free(&req);
 
 	return ret;
 }