discover/event: Ensure event struct exists for async callers
[petitboot] / discover / device-handler.c
index f6b6d22ed6a2f6f713b7f0d703b42e72901c01d9..346cb0221d7f08e8b5bcbd7b72f33c596f344f8b 100644 (file)
@@ -900,6 +900,7 @@ int device_handler_dhcp(struct device_handler *handler,
 
        /* create our context */
        ctx = device_handler_discover_context_create(handler, dev);
+       talloc_steal(ctx, event);
        ctx->event = event;
 
        iterate_parsers(ctx);
@@ -1171,6 +1172,7 @@ void device_handler_process_url(struct device_handler *handler,
        if (pb_url->scheme == pb_url_file)
                dev->device->type = DEVICE_TYPE_ANY;
        ctx = device_handler_discover_context_create(handler, dev);
+       talloc_steal(ctx, event);
        ctx->event = event;
 
        iterate_parsers(ctx);