Message ID | 1574756222-43976-1-git-send-email-pannengyuan@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | throttle-groups: fix memory leak in throttle_group_set_limits | expand |
On Tue 26 Nov 2019 09:17:02 AM CET, pannengyuan@huawei.com wrote: > --- a/block/throttle-groups.c > +++ b/block/throttle-groups.c > @@ -912,6 +912,7 @@ static void throttle_group_set_limits(Object *obj, Visitor *v, > unlock: > qemu_mutex_unlock(&tg->lock); > ret: > + qapi_free_ThrottleLimits(argp); > error_propagate(errp, local_err); > return; Thanks, but I also think that 'arg' is not used so it can be removed? diff --git a/block/throttle-groups.c b/block/throttle-groups.c index 77014c741b..37695b0cd7 100644 --- a/block/throttle-groups.c +++ b/block/throttle-groups.c @@ -893,8 +893,7 @@ static void throttle_group_set_limits(Object *obj, Visitor *v, { ThrottleGroup *tg = THROTTLE_GROUP(obj); ThrottleConfig cfg; - ThrottleLimits arg = { 0 }; - ThrottleLimits *argp = &arg; + ThrottleLimits *argp; Error *local_err = NULL; visit_type_ThrottleLimits(v, name, &argp, &local_err); @@ -912,6 +911,7 @@ static void throttle_group_set_limits(Object *obj, Visitor *v, unlock: qemu_mutex_unlock(&tg->lock); ret: + qapi_free_ThrottleLimits(argp); error_propagate(errp, local_err); return; } Berto
Thanks, I think it can be removed, I will send a new version later. On 2019/11/26 17:59, Alberto Garcia wrote: > On Tue 26 Nov 2019 09:17:02 AM CET, pannengyuan@huawei.com wrote: >> --- a/block/throttle-groups.c >> +++ b/block/throttle-groups.c >> @@ -912,6 +912,7 @@ static void throttle_group_set_limits(Object *obj, Visitor *v, >> unlock: >> qemu_mutex_unlock(&tg->lock); >> ret: >> + qapi_free_ThrottleLimits(argp); >> error_propagate(errp, local_err); >> return; > > Thanks, but I also think that 'arg' is not used so it can be removed? > > diff --git a/block/throttle-groups.c b/block/throttle-groups.c > index 77014c741b..37695b0cd7 100644 > --- a/block/throttle-groups.c > +++ b/block/throttle-groups.c > @@ -893,8 +893,7 @@ static void throttle_group_set_limits(Object *obj, Visitor *v, > { > ThrottleGroup *tg = THROTTLE_GROUP(obj); > ThrottleConfig cfg; > - ThrottleLimits arg = { 0 }; > - ThrottleLimits *argp = &arg; > + ThrottleLimits *argp; > Error *local_err = NULL; > > visit_type_ThrottleLimits(v, name, &argp, &local_err); > @@ -912,6 +911,7 @@ static void throttle_group_set_limits(Object *obj, Visitor *v, > unlock: > qemu_mutex_unlock(&tg->lock); > ret: > + qapi_free_ThrottleLimits(argp); > error_propagate(errp, local_err); > return; > } > > Berto > > . >
diff --git a/block/throttle-groups.c b/block/throttle-groups.c index 77014c7..88418e6 100644 --- a/block/throttle-groups.c +++ b/block/throttle-groups.c @@ -912,6 +912,7 @@ static void throttle_group_set_limits(Object *obj, Visitor *v, unlock: qemu_mutex_unlock(&tg->lock); ret: + qapi_free_ThrottleLimits(argp); error_propagate(errp, local_err); return; }