direct-io.hg

changeset 12162:de00775e39da

Fix freeing of records, when the given pointer is NULL.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Sat Oct 28 11:54:05 2006 +0100 (2006-10-28)
parents 0db0c19d3386
children 5cccc3ed0b1e
files tools/libxen/src/xen_host.c tools/libxen/src/xen_host_cpu.c tools/libxen/src/xen_network.c tools/libxen/src/xen_pif.c tools/libxen/src/xen_sr.c tools/libxen/src/xen_user.c tools/libxen/src/xen_vbd.c tools/libxen/src/xen_vdi.c tools/libxen/src/xen_vif.c tools/libxen/src/xen_vm.c tools/libxen/src/xen_vtpm.c
line diff
     1.1 --- a/tools/libxen/src/xen_host.c	Sat Oct 28 11:50:35 2006 +0100
     1.2 +++ b/tools/libxen/src/xen_host.c	Sat Oct 28 11:54:05 2006 +0100
     1.3 @@ -76,6 +76,10 @@ const abstract_type xen_host_record_abst
     1.4  void
     1.5  xen_host_record_free(xen_host_record *record)
     1.6  {
     1.7 +    if (record == NULL)
     1.8 +    {
     1.9 +        return;
    1.10 +    }
    1.11      free(record->handle);
    1.12      free(record->uuid);
    1.13      free(record->name_label);
     2.1 --- a/tools/libxen/src/xen_host_cpu.c	Sat Oct 28 11:50:35 2006 +0100
     2.2 +++ b/tools/libxen/src/xen_host_cpu.c	Sat Oct 28 11:54:05 2006 +0100
     2.3 @@ -78,6 +78,10 @@ const abstract_type xen_host_cpu_record_
     2.4  void
     2.5  xen_host_cpu_record_free(xen_host_cpu_record *record)
     2.6  {
     2.7 +    if (record == NULL)
     2.8 +    {
     2.9 +        return;
    2.10 +    }
    2.11      free(record->handle);
    2.12      free(record->uuid);
    2.13      xen_host_record_opt_free(record->host);
     3.1 --- a/tools/libxen/src/xen_network.c	Sat Oct 28 11:50:35 2006 +0100
     3.2 +++ b/tools/libxen/src/xen_network.c	Sat Oct 28 11:54:05 2006 +0100
     3.3 @@ -74,6 +74,10 @@ const abstract_type xen_network_record_a
     3.4  void
     3.5  xen_network_record_free(xen_network_record *record)
     3.6  {
     3.7 +    if (record == NULL)
     3.8 +    {
     3.9 +        return;
    3.10 +    }
    3.11      free(record->handle);
    3.12      free(record->uuid);
    3.13      free(record->name_label);
     4.1 --- a/tools/libxen/src/xen_pif.c	Sat Oct 28 11:50:35 2006 +0100
     4.2 +++ b/tools/libxen/src/xen_pif.c	Sat Oct 28 11:54:05 2006 +0100
     4.3 @@ -80,6 +80,10 @@ const abstract_type xen_pif_record_abstr
     4.4  void
     4.5  xen_pif_record_free(xen_pif_record *record)
     4.6  {
     4.7 +    if (record == NULL)
     4.8 +    {
     4.9 +        return;
    4.10 +    }
    4.11      free(record->handle);
    4.12      free(record->uuid);
    4.13      free(record->name);
     5.1 --- a/tools/libxen/src/xen_sr.c	Sat Oct 28 11:50:35 2006 +0100
     5.2 +++ b/tools/libxen/src/xen_sr.c	Sat Oct 28 11:54:05 2006 +0100
     5.3 @@ -79,6 +79,10 @@ const abstract_type xen_sr_record_abstra
     5.4  void
     5.5  xen_sr_record_free(xen_sr_record *record)
     5.6  {
     5.7 +    if (record == NULL)
     5.8 +    {
     5.9 +        return;
    5.10 +    }
    5.11      free(record->handle);
    5.12      free(record->uuid);
    5.13      free(record->name_label);
     6.1 --- a/tools/libxen/src/xen_user.c	Sat Oct 28 11:50:35 2006 +0100
     6.2 +++ b/tools/libxen/src/xen_user.c	Sat Oct 28 11:54:05 2006 +0100
     6.3 @@ -60,6 +60,10 @@ const abstract_type xen_user_record_abst
     6.4  void
     6.5  xen_user_record_free(xen_user_record *record)
     6.6  {
     6.7 +    if (record == NULL)
     6.8 +    {
     6.9 +        return;
    6.10 +    }
    6.11      free(record->handle);
    6.12      free(record->uuid);
    6.13      free(record->short_name);
     7.1 --- a/tools/libxen/src/xen_vbd.c	Sat Oct 28 11:50:35 2006 +0100
     7.2 +++ b/tools/libxen/src/xen_vbd.c	Sat Oct 28 11:54:05 2006 +0100
     7.3 @@ -79,6 +79,10 @@ const abstract_type xen_vbd_record_abstr
     7.4  void
     7.5  xen_vbd_record_free(xen_vbd_record *record)
     7.6  {
     7.7 +    if (record == NULL)
     7.8 +    {
     7.9 +        return;
    7.10 +    }
    7.11      free(record->handle);
    7.12      free(record->uuid);
    7.13      xen_vm_record_opt_free(record->vm);
     8.1 --- a/tools/libxen/src/xen_vdi.c	Sat Oct 28 11:50:35 2006 +0100
     8.2 +++ b/tools/libxen/src/xen_vdi.c	Sat Oct 28 11:54:05 2006 +0100
     8.3 @@ -93,6 +93,10 @@ const abstract_type xen_vdi_record_abstr
     8.4  void
     8.5  xen_vdi_record_free(xen_vdi_record *record)
     8.6  {
     8.7 +    if (record == NULL)
     8.8 +    {
     8.9 +        return;
    8.10 +    }
    8.11      free(record->handle);
    8.12      free(record->uuid);
    8.13      free(record->name_label);
     9.1 --- a/tools/libxen/src/xen_vif.c	Sat Oct 28 11:50:35 2006 +0100
     9.2 +++ b/tools/libxen/src/xen_vif.c	Sat Oct 28 11:54:05 2006 +0100
     9.3 @@ -84,6 +84,10 @@ const abstract_type xen_vif_record_abstr
     9.4  void
     9.5  xen_vif_record_free(xen_vif_record *record)
     9.6  {
     9.7 +    if (record == NULL)
     9.8 +    {
     9.9 +        return;
    9.10 +    }
    9.11      free(record->handle);
    9.12      free(record->uuid);
    9.13      free(record->name);
    10.1 --- a/tools/libxen/src/xen_vm.c	Sat Oct 28 11:50:35 2006 +0100
    10.2 +++ b/tools/libxen/src/xen_vm.c	Sat Oct 28 11:54:05 2006 +0100
    10.3 @@ -189,6 +189,10 @@ const abstract_type xen_vm_record_abstra
    10.4  void
    10.5  xen_vm_record_free(xen_vm_record *record)
    10.6  {
    10.7 +    if (record == NULL)
    10.8 +    {
    10.9 +        return;
   10.10 +    }
   10.11      free(record->handle);
   10.12      free(record->uuid);
   10.13      free(record->name_label);
    11.1 --- a/tools/libxen/src/xen_vtpm.c	Sat Oct 28 11:50:35 2006 +0100
    11.2 +++ b/tools/libxen/src/xen_vtpm.c	Sat Oct 28 11:54:05 2006 +0100
    11.3 @@ -69,6 +69,10 @@ const abstract_type xen_vtpm_record_abst
    11.4  void
    11.5  xen_vtpm_record_free(xen_vtpm_record *record)
    11.6  {
    11.7 +    if (record == NULL)
    11.8 +    {
    11.9 +        return;
   11.10 +    }
   11.11      free(record->handle);
   11.12      free(record->uuid);
   11.13      xen_vm_record_opt_free(record->vm);