[libvirt] [PATCH 2/3] Add Processor Information to virSysinfoRead() from dmidecode type 4

Daniel P. Berrange berrange at redhat.com
Fri Jun 24 14:24:00 UTC 2011


On Tue, Jun 21, 2011 at 01:20:30PM +0900, Minoru Usui wrote:
> Add Processor Information to virSysinfoRead() from dmidecode type 4
> 
> Signed-off-by: Minoru Usui <usui at mxm.nes.nec.co.jp>
> ---
>  src/util/sysinfo.c |  207 +++++++++++++++++++++++++++++++++++++++++++++++++++-
>  src/util/sysinfo.h |   19 +++++
>  2 files changed, 225 insertions(+), 1 deletions(-)
> 
> diff --git a/src/util/sysinfo.c b/src/util/sysinfo.c
> index 53122f7..a1eb92b 100644
> --- a/src/util/sysinfo.c
> +++ b/src/util/sysinfo.c
> @@ -72,6 +72,9 @@ void virSysinfoDefFree(virSysinfoDefPtr def)
>      VIR_FREE(def->system_uuid);
>      VIR_FREE(def->system_sku);
>      VIR_FREE(def->system_family);
> +
> +    VIR_FREE(def->processor);

This frees the 'virProcessinfoDef' instance, but what
about all the allocated strings inside it ?

> +
>      VIR_FREE(def);
>  }
>  
> @@ -190,6 +193,107 @@ no_memory:
>      return NULL;
>  }
>  
> +static char *
> +parseProcessorInfo(char *base, virSysinfoDefPtr ret)

As with previous patch, please add 'virSysinfo' prefix on all
method names

> +static void
> +ProcessorInfoFormat(virSysinfoDefPtr def, const char *prefix, virBufferPtr buf)

> diff --git a/src/util/sysinfo.h b/src/util/sysinfo.h
> index f69b76c..f098e9d 100644
> --- a/src/util/sysinfo.h
> +++ b/src/util/sysinfo.h
> @@ -33,6 +33,22 @@ enum virSysinfoType {
>      VIR_SYSINFO_LAST
>  };
>  
> +typedef struct _virProcessorinfoDef virProcessorinfoDef;
> +typedef virProcessorinfoDef *virProcessorinfoDefPtr;
> +struct _virProcessorinfoDef {
> +    char *processor_socket_destination;
> +    char *processor_type;
> +    char *processor_family;
> +    char *processor_manufacturer;
> +    char *processor_signature;
> +    char *processor_version;
> +    char *processor_external_clock;
> +    char *processor_max_speed;
> +    char *processor_status;
> +    char *processor_serial_number;
> +    char *processor_part_number;
> +};

All these strings are leaked AFAICT

Also can we name this struct

  virSysinfoProcessorDef

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list