On Sun, Sep 14, 2014 at 01:23:13PM +0300, Chrysostomos Nanakos wrote:
> @@ -63,10 +64,19 @@ static void iothread_instance_finalize(Object *obj)
>  
>  static void iothread_complete(UserCreatable *obj, Error **errp)
>  {
> +    int ret;
> +    Error *local_error = NULL;
>      IOThread *iothread = IOTHREAD(obj);
>  
>      iothread->stopping = false;
> -    iothread->ctx = aio_context_new();
> +    ret = aio_context_new(&iothread->ctx, &local_error);
> +    if (ret < 0) {
> +        errno = -ret;
> +        error_report("%s", error_get_pretty(local_error));
> +        error_report("iothread_complete failed");
> +        error_free(local_error);
> +        exit(1);
> +    }

Why use error_report()?  The function takes an errp argument so
local_error should be propagated.

> @@ -2893,7 +2895,14 @@ int main(int argc, char **argv)
>      error_set_progname(argv[0]);
>      qemu_init_exec_dir(argv[0]);
>  
> -    qemu_init_main_loop();
> +    ret = qemu_init_main_loop(&local_error);
> +    if (ret < 0) {
> +        errno = -ret;
> +        error_report("%s", error_get_pretty(local_error));
> +        error_free(local_error);
> +        error_exit("qemu_init_main_loop failed");
> +    }

IMO it's okay to leak local_error here:
error_exit("%s", error_get_pretty(local_error));

qemu_init_main_loop failed is not a meaningful error message, please
drop it and keep just the detailed message.

Attachment: pgpo9Na9NKgTe.pgp
Description: PGP signature

Reply via email to