diff mbox series

[v1,5/5] ui-system: Use argv for talloc context

Message ID e5d07a40272d1761cb9ebdef2722356965bfc482.1587958237.git.geoff@infradead.org
State New
Headers show
Series [v1,1/5] ncurses/nc-menu: Remove stray declaration | expand

Commit Message

Geoff Levand April 27, 2020, 3:38 a.m. UTC
Process instances are no longer allocated using talloc, so use the argv
instance as the talloc context.

Fixes runtime errors like these when using the --start-daemon option:

  talloc_chunk_from_ptr: Assertion `0 && "Bad talloc magic value - unknown value"' failed.

Signed-off-by: Geoff Levand <geoff@infradead.org>
---
 ui/common/ui-system.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Jeremy Kerr May 3, 2020, 4:33 a.m. UTC | #1
Hi Geoff,

> Process instances are no longer allocated using talloc, so use the argv
> instance as the talloc context.

Looks good, applied.

Cheers,


Jeremy
diff mbox series

Patch

diff --git a/ui/common/ui-system.c b/ui/common/ui-system.c
index 02142db..dca581a 100644
--- a/ui/common/ui-system.c
+++ b/ui/common/ui-system.c
@@ -47,8 +47,8 @@  int pb_start_daemon(void *ctx)
 
 	process = process_create(ctx);
 
-	argv = talloc_array(process, const char *, 2);
-	name = talloc_asprintf(process, "%s/sbin/pb-discover",
+	argv = talloc_array(NULL, const char *, 2);
+	name = talloc_asprintf(argv, "%s/sbin/pb-discover",
 			pb_system_apps.prefix);
 
 	argv[0] = name;
@@ -59,6 +59,7 @@  int pb_start_daemon(void *ctx)
 
 	result = process_run_async(process);
 	process_release(process);
+	talloc_free(argv);
 
 	return result;
 }