Assigning directly to *errp is not valid, as errp may be NULL,
&error_fatal, or &error_abort. Use error_propagate() instead.
Cc: Juan Quintela <quintela@redhat.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
migration/migration.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/migration/migration.c b/migration/migration.c
index 48c94c9ca1..5a8bef3ef5 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1188,7 +1188,7 @@ bool migration_is_blocked(Error **errp)
}
if (migration_blockers) {
- *errp = error_copy(migration_blockers->data);
+ error_propagate(errp, error_copy(migration_blockers->data));
return true;
}
--
2.11.0.259.g40922b1
Eduardo Habkost <ehabkost@redhat.com> wrote: > Assigning directly to *errp is not valid, as errp may be NULL, > &error_fatal, or &error_abort. Use error_propagate() instead. > > Cc: Juan Quintela <quintela@redhat.com> > Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com> > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> queued Thanks.
* Eduardo Habkost (ehabkost@redhat.com) wrote:
> Assigning directly to *errp is not valid, as errp may be NULL,
> &error_fatal, or &error_abort. Use error_propagate() instead.
>
> Cc: Juan Quintela <quintela@redhat.com>
> Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> migration/migration.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/migration/migration.c b/migration/migration.c
> index 48c94c9ca1..5a8bef3ef5 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -1188,7 +1188,7 @@ bool migration_is_blocked(Error **errp)
> }
>
> if (migration_blockers) {
> - *errp = error_copy(migration_blockers->data);
> + error_propagate(errp, error_copy(migration_blockers->data));
> return true;
> }
if errp is NULL doesn't that leak the error_copy ?
Dave
>
> --
> 2.11.0.259.g40922b1
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
* Dr. David Alan Gilbert (dgilbert@redhat.com) wrote:
> * Eduardo Habkost (ehabkost@redhat.com) wrote:
> > Assigning directly to *errp is not valid, as errp may be NULL,
> > &error_fatal, or &error_abort. Use error_propagate() instead.
> >
> > Cc: Juan Quintela <quintela@redhat.com>
> > Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> > ---
> > migration/migration.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/migration/migration.c b/migration/migration.c
> > index 48c94c9ca1..5a8bef3ef5 100644
> > --- a/migration/migration.c
> > +++ b/migration/migration.c
> > @@ -1188,7 +1188,7 @@ bool migration_is_blocked(Error **errp)
> > }
> >
> > if (migration_blockers) {
> > - *errp = error_copy(migration_blockers->data);
> > + error_propagate(errp, error_copy(migration_blockers->data));
> > return true;
> > }
>
> if errp is NULL doesn't that leak the error_copy ?
To answer myself, no it doesn't - error_propagate free's it in that
case.
Dave
> Dave
>
> >
> > --
> > 2.11.0.259.g40922b1
> >
> --
> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
© 2016 - 2025 Red Hat, Inc.