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

Re: [Xen-devel] [PATCH 26/28] mini-os: fix various memory leaks in consfront



Matthew Daley, le Wed 18 Sep 2013 15:38:02 +1200, a écrit :
> Coverity-ID: 1055816
> Coverity-ID: 1055817
> Coverity-ID: 1055818
> Signed-off-by: Matthew Daley <mattjd@xxxxxxxxx>

Acked-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>

> ---
>  extras/mini-os/console/xenbus.c |    9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/extras/mini-os/console/xenbus.c b/extras/mini-os/console/xenbus.c
> index 4194982..b317114 100644
> --- a/extras/mini-os/console/xenbus.c
> +++ b/extras/mini-os/console/xenbus.c
> @@ -42,7 +42,8 @@ void free_consfront(struct consfront_dev *dev)
>  
>  close:
>      if (err) free(err);
> -    xenbus_unwatch_path_token(XBT_NIL, path, path);
> +    err = xenbus_unwatch_path_token(XBT_NIL, path, path);
> +    if (err) free(err);
>  
>      mask_evtchn(dev->evtchn);
>      unbind_evtchn(dev->evtchn);
> @@ -58,7 +59,7 @@ close:
>  struct consfront_dev *init_consfront(char *_nodename)
>  {
>      xenbus_transaction_t xbt;
> -    char* err;
> +    char* err = NULL;
>      char* message=NULL;
>      int retry=0;
>      char* msg = NULL;
> @@ -87,7 +88,7 @@ struct consfront_dev *init_consfront(char *_nodename)
>  
>      snprintf(path, sizeof(path), "%s/backend-id", nodename);
>      if ((res = xenbus_read_integer(path)) < 0) 
> -        return NULL;
> +        goto error;
>      else
>          dev->dom = res;
>      evtchn_alloc_unbound(dev->dom, console_handle_input, dev, &dev->evtchn);
> @@ -170,7 +171,7 @@ done:
>              msg = xenbus_wait_for_state_change(path, &state, &dev->events);
>          if (msg != NULL || state != XenbusStateConnected) {
>              printk("backend not available, state=%d\n", state);
> -            xenbus_unwatch_path_token(XBT_NIL, path, path);
> +            err = xenbus_unwatch_path_token(XBT_NIL, path, path);
>              goto error;
>          }
>      }
> -- 
> 1.7.10.4
> 

-- 
Samuel
Now I know someone out there is going to claim, "Well then, UNIX is intuitive,
because you only need to learn 5000 commands, and then everything else follows
from that! Har har har!"
(Andy Bates in comp.os.linux.misc, on "intuitive interfaces", slightly
defending Macs.)

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.