[libvirt] [PATCH v2 12/37] Adapt to VIR_STRDUP in src/node_device/*

John Ferlan jferlan at redhat.com
Mon Apr 29 18:51:32 UTC 2013


On 04/29/2013 09:50 AM, Michal Privoznik wrote:
> ---
>  src/node_device/node_device_driver.c |  28 ++++------
>  src/node_device/node_device_hal.c    |  13 ++---
>  src/node_device/node_device_udev.c   | 102 +++++++++++++++--------------------
>  3 files changed, 60 insertions(+), 83 deletions(-)
> 
...
> @@ -388,8 +385,7 @@ nodeDeviceListCaps(virNodeDevicePtr dev, char **const names, int maxnames)
>      }
>  
>      for (caps = obj->def->caps; caps && ncaps < maxnames; caps = caps->next) {
> -        names[ncaps] = strdup(virNodeDevCapTypeToString(caps->type));
> -        if (names[ncaps++] == NULL) {
> +        if (VIR_STRDUP(names[ncaps], virNodeDevCapTypeToString(caps->type)) < 0) {

Lost the autoincrement              ^^^

>              virReportOOMError();
>              goto cleanup;
>          }

...

> --- a/src/node_device/node_device_hal.c
> +++ b/src/node_device/node_device_hal.c
> @@ -445,10 +445,10 @@ static void dev_create(const char *udi)
>      virNodeDeviceDefPtr def = NULL;
>      const char *name = hal_name(udi);
>      int rv;
> -    char *privData = strdup(udi);
> +    char *privData;
>      char *devicePath = NULL;
>  
> -    if (!privData)
> +    if (VIR_STRDUP(privDatam udi) < 0)

s/m/,/

...




More information about the libvir-list mailing list