diff mbox series

error: Fix "Converting to ERRP_GUARD()" doc on "valid at return"

Message ID 20210125132635.1253219-1-armbru@redhat.com
State New
Headers show
Series error: Fix "Converting to ERRP_GUARD()" doc on "valid at return" | expand

Commit Message

Markus Armbruster Jan. 25, 2021, 1:26 p.m. UTC
Setting errp = NULL is wrong: the automatic error propagation still
propagates the dangling pointer _auto_errp_prop.local_err.  We need to
set *errp = NULL to clear the dangling pointer.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 include/qapi/error.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Vladimir Sementsov-Ogievskiy Jan. 25, 2021, 1:54 p.m. UTC | #1
25.01.2021 16:26, Markus Armbruster wrote:
> Setting errp = NULL is wrong: the automatic error propagation still
> propagates the dangling pointer _auto_errp_prop.local_err.  We need to
> set *errp = NULL to clear the dangling pointer.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

> ---
>   include/qapi/error.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/qapi/error.h b/include/qapi/error.h
> index eaa05c4837..4a9260b0cc 100644
> --- a/include/qapi/error.h
> +++ b/include/qapi/error.h
> @@ -235,7 +235,7 @@
>    *    error_propagate_prepend(errp, *errp, ...) by error_prepend(errp, ...)
>    *
>    * 4. Ensure @errp is valid at return: when you destroy *errp, set
> - *    errp = NULL.
> + *    *errp = NULL.
>    *
>    * Example:
>    *
>
Philippe Mathieu-Daudé Jan. 25, 2021, 3:07 p.m. UTC | #2
On 1/25/21 2:26 PM, Markus Armbruster wrote:
> Setting errp = NULL is wrong: the automatic error propagation still
> propagates the dangling pointer _auto_errp_prop.local_err.  We need to
> set *errp = NULL to clear the dangling pointer.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  include/qapi/error.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
diff mbox series

Patch

diff --git a/include/qapi/error.h b/include/qapi/error.h
index eaa05c4837..4a9260b0cc 100644
--- a/include/qapi/error.h
+++ b/include/qapi/error.h
@@ -235,7 +235,7 @@ 
  *    error_propagate_prepend(errp, *errp, ...) by error_prepend(errp, ...)
  *
  * 4. Ensure @errp is valid at return: when you destroy *errp, set
- *    errp = NULL.
+ *    *errp = NULL.
  *
  * Example:
  *