qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH V11 13/17] block: dump to buffer for bdrv_snapsh


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH V11 13/17] block: dump to buffer for bdrv_snapshot_dump() and bdrv_image_info_dump()
Date: Mon, 8 Apr 2013 15:36:37 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, Apr 02, 2013 at 07:47:26PM +0800, Wenchao Xia wrote:
> diff --git a/qemu-img.c b/qemu-img.c
> index 5b229a9..032f68c 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -1558,18 +1558,24 @@ static void dump_snapshots(BlockDriverState *bs)
>  {
>      QEMUSnapshotInfo *sn_tab, *sn;
>      int nb_sns, i;
> -    char buf[256];
> +    GString *buf = g_string_new(NULL);
>  
>      nb_sns = bdrv_snapshot_list(bs, &sn_tab);
>      if (nb_sns <= 0)
>          return;

Leaks buf.

> diff --git a/savevm.c b/savevm.c
> index e4e0008..ce0bbe1 100644
> --- a/savevm.c
> +++ b/savevm.c
> @@ -2466,7 +2466,7 @@ void do_info_snapshots(Monitor *mon, const QDict *qdict)
>      int nb_sns, i, ret, available;
>      int total;
>      int *available_snapshots;
> -    char buf[256];
> +    GString *buf = NULL;
>  
>      bs = bdrv_snapshots();
>      if (!bs) {
> @@ -2509,11 +2509,16 @@ void do_info_snapshots(Monitor *mon, const QDict 
> *qdict)
>      }
>  
>      if (total > 0) {

Please declare buf here since it is only used in this scope.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]