On Tue, Jan 20, 2015 at 12:31:30PM -0500, Jeff Cody wrote:
> Rather than declaring 'backing_filename2' on the stack in
> bdrv_quiery_image_info(), dynamically allocate it on the heap.

s/quiery/query/

> 
> Signed-off-by: Jeff Cody <jc...@redhat.com>
> ---
>  block/qapi.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/block/qapi.c b/block/qapi.c
> index a6fd6f7..e51bade 100644
> --- a/block/qapi.c
> +++ b/block/qapi.c
> @@ -175,7 +175,7 @@ void bdrv_query_image_info(BlockDriverState *bs,
>  {
>      int64_t size;
>      const char *backing_filename;
> -    char backing_filename2[1024];
> +    char *backing_filename2 = NULL;
>      BlockDriverInfo bdi;
>      int ret;
>      Error *err = NULL;
> @@ -211,13 +211,14 @@ void bdrv_query_image_info(BlockDriverState *bs,
>  
>      backing_filename = bs->backing_file;
>      if (backing_filename[0] != '\0') {
> +        backing_filename2 = g_malloc0(1024);

backing_filename2 is only used inside the body of this if statement.
Please move the declaration in here to avoid initializing with NULL
(that value is never used but I had to check the surrounding code to
figure that out).

Attachment: pgp_rlmP7IxKY.pgp
Description: PGP signature

Reply via email to