[libvirt] [PATCH] fix memory leak in qemuMonitorJSONAttachCharDevCommand

Erik Skultety eskultet at redhat.com
Wed Jun 14 08:58:19 UTC 2017


On Mon, Jun 12, 2017 at 02:05:55AM -0400, Yi Wang wrote:
> The @tlsalias allocated in qemuAliasTLSObjFromSrcAlias may lost
>  when append string to json.
>
> Signed-off-by: Xi Xu <xu.xi8 at zte.com.cn>
> ---
>  src/qemu/qemu_monitor_json.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
> index f208dd0..773de0f 100644
> --- a/src/qemu/qemu_monitor_json.c
> +++ b/src/qemu/qemu_monitor_json.c
> @@ -6487,6 +6487,7 @@ qemuMonitorJSONAttachCharDevCommand(const char *chrID,
>
>              if (virJSONValueObjectAppendString(data, "tls-creds", tlsalias) < 0)
>                  goto error;
> +            VIR_FREE(tlsalias);
>          }
>          break;

Although correct, we needed only 1 place where all the cleanup takes place, see
the patch I merged upstream [1]

Thanks,
Erik

[1] http://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=bb12db16b41032cf7c6001a4d0e7ee20720c93a0

>
> --
> 1.8.3.1
>
>
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list




More information about the libvir-list mailing list