diff mbox

[PATCHv2,1/6] qcow2: don't leak buffer for unexpected qcow_version in header

Message ID 87bolhn67l.fsf@rho.meyering.net
State New
Headers show

Commit Message

Jim Meyering May 21, 2012, 11:06 a.m. UTC
Signed-off-by: Jim Meyering <meyering@redhat.com>
---
Thanks to Kevin Wolf for the improvement.

 block/qcow2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--
1.7.10.2.552.gaa3bb87

Comments

Kevin Wolf May 21, 2012, 11:24 a.m. UTC | #1
Am 21.05.2012 13:06, schrieb Jim Meyering:
> 
> Signed-off-by: Jim Meyering <meyering@redhat.com>
> ---
> Thanks to Kevin Wolf for the improvement.
> 
>  block/qcow2.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/block/qcow2.c b/block/qcow2.c
> index 655799c..c2e49cd 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -919,7 +919,8 @@ int qcow2_update_header(BlockDriverState *bs)
>          ret = sizeof(*header);
>          break;
>      default:
> -        return -EINVAL;
> +        ret = -EINVAL;
> +        goto fail;
>      }
> 
>      buf += ret;
> --
> 1.7.10.2.552.gaa3bb87

Acked-by: Kevin Wolf <kwolf@redhat.com>
diff mbox

Patch

diff --git a/block/qcow2.c b/block/qcow2.c
index 655799c..c2e49cd 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -919,7 +919,8 @@  int qcow2_update_header(BlockDriverState *bs)
         ret = sizeof(*header);
         break;
     default:
-        return -EINVAL;
+        ret = -EINVAL;
+        goto fail;
     }

     buf += ret;