[Libvirt-cim] [PATCH 3/4] xml_parse_test: Fix invalid dereference

Sharad Mishra snmishra at us.ibm.com
Wed Jan 18 20:47:37 UTC 2012


+1

Sharad Mishra
Open Virtualization
Linux Technology Center
IBM

libvirt-cim-bounces at redhat.com wrote on 01/18/2012 08:06:11 AM:

> "Eduardo Lima (Etrunko)" <eblima at linux.vnet.ibm.com>
> Sent by: libvirt-cim-bounces at redhat.com
>
> 01/18/2012 08:06 AM
>
> Please respond to
> List for discussion and development of libvirt CIM
<libvirt-cim at redhat.com>
>
> To
>
> libvirt-cim at redhat.com
>
> cc
>
> "Eduardo Lima \(Etrunko\)" <eblima at br.ibm.com>
>
> Subject
>
> [Libvirt-cim] [PATCH 3/4] xml_parse_test: Fix invalid dereference
>
> From: "Eduardo Lima (Etrunko)" <eblima at br.ibm.com>
>
> As revealed by recent Coverity scan report provided by Red Hat:
> https://bugzilla.redhat.com/show_bug.cgi?id=750418
> https://bugzilla.redhat.com/attachment.cgi?id=552325
>
> Error: USE_AFTER_FREE:
> xml_parse_test.c:239: freed_arg: "free" frees "xml".
> xml_parse_test.c:242: pass_freed_arg: Passing freed pointer "xml" as
> an argument to function "printf".
>
> Signed-off-by: Eduardo Lima (Etrunko) <eblima at br.ibm.com>
> ---
>  libxkutil/xml_parse_test.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/libxkutil/xml_parse_test.c b/libxkutil/xml_parse_test.c
> index 16ceefb..384593d 100644
> --- a/libxkutil/xml_parse_test.c
> +++ b/libxkutil/xml_parse_test.c
> @@ -236,11 +236,10 @@ static int dominfo_from_file(const char
> *fname, struct domain **d)
>
>          ret = get_dominfo_from_xml(xml, d);
>
> +        printf("XML:\n%s", xml);
>          free(xml);
>          fclose(file);
>
> -        printf("XML:\n%s", xml);
> -
>          return ret;
>  }
>
> --
> 1.7.7.5
>
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim
>




More information about the Libvirt-cim mailing list