[Libvirt-cim] [PATCH] Fix memory leak in Virt_ComputerSystem

Richard Maciel rmaciel at linux.vnet.ibm.com
Mon Jun 15 21:33:49 UTC 2009


+1

Kaitlin Rupert wrote:
> # HG changeset patch
> # User Kaitlin Rupert <karupert at us.ibm.com>
> # Date 1244848480 25200
> # Node ID df0dcd8f614f2dbd2f8f2973074396816c3fdb73
> # Parent  6cef00a4aca53a184b97ff3f87f059cb59beef5c
> Fix memory leak in Virt_ComputerSystem
> 
> Be sure to free the type variable once we're done with it.
> 
> Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>
> 
> diff -r 6cef00a4aca5 -r df0dcd8f614f src/Virt_ComputerSystem.c
> --- a/src/Virt_ComputerSystem.c	Fri Jun 12 15:11:51 2009 -0700
> +++ b/src/Virt_ComputerSystem.c	Fri Jun 12 16:14:40 2009 -0700
> @@ -1091,7 +1091,7 @@
>          s = __state_change(name, state, reference);
> 
>          if (s.rc == CMPI_RC_OK) {
> -                char *type;
> +                char *type = NULL;
> 
>                  type = get_typed_class(CLASSNAME(reference),
>                                         "ComputerSystemModifiedIndication");
> @@ -1102,6 +1102,8 @@
>                                          type,
>                                          NAMESPACE(reference));
>                  rc = 0;
> +
> +                free(type);
>          }
>   out:
>          CMReturnData(results, &rc, CMPI_uint32);
> 
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim


-- 
Richard Maciel, MSc
IBM Linux Technology Center
rmaciel at linux.vnet.ibm.com




More information about the Libvirt-cim mailing list