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

Geoff Levand geoff at infradead.org
Mon Apr 27 13:38:31 AEST 2020


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 at infradead.org>
---
 ui/common/ui-system.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

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;
 }
-- 
2.20.1



More information about the Petitboot mailing list