diff mbox

[10/14] block/qapi: Plug memory leak in dump_qobject() case QTYPE_QERROR

Message ID 1401125835-21765-11-git-send-email-armbru@redhat.com
State New
Headers show

Commit Message

Markus Armbruster May 26, 2014, 5:37 p.m. UTC
Introduced in commit a8d8ecb.  Spotted by Coverity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 block/qapi.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Benoît Canet May 27, 2014, 10:52 a.m. UTC | #1
The Monday 26 May 2014 à 19:37:11 (+0200), Markus Armbruster wrote :
> Introduced in commit a8d8ecb.  Spotted by Coverity.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  block/qapi.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/block/qapi.c b/block/qapi.c
> index 75f44f1..97e1641 100644
> --- a/block/qapi.c
> +++ b/block/qapi.c
> @@ -475,6 +475,7 @@ static void dump_qobject(fprintf_function func_fprintf, void *f,
>          case QTYPE_QERROR: {
>              QString *value = qerror_human((QError *)obj);
>              func_fprintf(f, "%s", qstring_get_str(value));
> +            QDECREF(value);
>              break;
>          }
>          case QTYPE_NONE:
> -- 
> 1.9.3
> 
> 
Reviewed-by: Benoit Canet <benoit@irqsave.net>
diff mbox

Patch

diff --git a/block/qapi.c b/block/qapi.c
index 75f44f1..97e1641 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -475,6 +475,7 @@  static void dump_qobject(fprintf_function func_fprintf, void *f,
         case QTYPE_QERROR: {
             QString *value = qerror_human((QError *)obj);
             func_fprintf(f, "%s", qstring_get_str(value));
+            QDECREF(value);
             break;
         }
         case QTYPE_NONE: