[libvirt] [cim][PATCH 1/2] Fix memory leak in set_other_id_info

John Ferlan jferlan at redhat.com
Mon Dec 18 13:31:06 UTC 2017



On 12/15/2017 09:05 AM, Adam Majer wrote:
> model was allocated by asprintf but never freed after usage
> and assignement.

assignment

> 
> Signed-off-by: Adam Majer <amajer at suse.de>
> ---
>  src/Virt_ComputerSystem.c | 2 ++
>  1 file changed, 2 insertions(+)
> 

Looks OK; however, there hasn't been a non build related source code
change to libvirt-cim since June 2014. So while this could be pushed,
I'm curious to understand why the "sudden interest" in CIM?  The last
release was July 2013!

Perhaps if you'd generated a --cover-letter with your git send-email to
explain that would have helped. See https://libvirt.org/hacking.html for
some general patch submission guidelines when there's more than one
patch in a series, although for libvirt-cim perhaps only the first
section applies as virtually none of the code formatting and naming
would apply...

John

> diff --git a/src/Virt_ComputerSystem.c b/src/Virt_ComputerSystem.c
> index da07f93..b4930ac 100644
> --- a/src/Virt_ComputerSystem.c
> +++ b/src/Virt_ComputerSystem.c
> @@ -417,6 +417,8 @@ static int set_other_id_info(const CMPIBroker *broker,
>                                      CMPI_string);
>          }
>  
> +        free(model);
> +
>          CMSetProperty(instance, "OtherIdentifyingInfo",
>                        &id_info, CMPI_stringA);
>  
> 




More information about the libvir-list mailing list