poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/4] ios: Remove usage of xalloc from ios-dev-nbd.c


From: Jose E. Marchesi
Subject: Re: [PATCH 2/4] ios: Remove usage of xalloc from ios-dev-nbd.c
Date: Thu, 14 May 2020 21:17:14 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Hi Tim.

This looks OK.
Thanks!

    2020-05-07  Tim Rühsen  <address@hidden>
    
            * libpoke/ios-dev-nbd.c (ios_dev_nbd_open): Replace
            xmalloc and xstrdup by malloc and strdup.
            Remove include xalloc.h.
    ---
     ChangeLog             |  6 ++++++
     libpoke/ios-dev-nbd.c | 19 ++++++++++++++++---
     2 files changed, 22 insertions(+), 3 deletions(-)
    
    diff --git a/libpoke/ios-dev-nbd.c b/libpoke/ios-dev-nbd.c
    index bb8227b0..cfc68d48 100644
    --- a/libpoke/ios-dev-nbd.c
    +++ b/libpoke/ios-dev-nbd.c
    @@ -22,7 +22,6 @@
     #include <stdlib.h>
     #include <string.h>
     #include <unistd.h>
    -#include <xalloc.h>
    
     #include <libnbd.h>
    
    @@ -94,9 +93,15 @@ ios_dev_nbd_open (const char *handler, uint64_t flags, 
int *error)
       if (size < 0)
         goto err;
    
    -  nio = xmalloc (sizeof *nio);
    +  nio = malloc (sizeof *nio);
    +  if (!nio)
    +    goto err;
    +
    +  nio->uri = strdup (handler);
    +  if (!nio->uri)
    +    goto err;
    +
       nio->nbd = nbd;
    -  nio->uri = xstrdup (handler);
       nio->size = size;
       nio->flags = flags;
    
    @@ -106,7 +111,15 @@ ios_dev_nbd_open (const char *handler, uint64_t flags, 
int *error)
       /* Worth logging nbd_get_error ()?  */
       if (error)
         *error = err;
    +
    +  if (nio)
    +    {
    +      free (nio->uri);
    +      free (nio);
    +    }
    +
       nbd_close (nbd);
    +
       return NULL;
     }
    
    --
    2.26.2



reply via email to

[Prev in Thread] Current Thread [Next in Thread]