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

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



Matthew Daley, le Wed 18 Sep 2013 15:38:00 +1200, a écrit :
> Coverity-ID: 1055832
> Coverity-ID: 1055833
> Signed-off-by: Matthew Daley <mattjd@xxxxxxxxx>

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

> ---
>  extras/mini-os/netfront.c |   17 +++++++++++------
>  1 file changed, 11 insertions(+), 6 deletions(-)
> 
> diff --git a/extras/mini-os/netfront.c b/extras/mini-os/netfront.c
> index a999985..3a5be64 100644
> --- a/extras/mini-os/netfront.c
> +++ b/extras/mini-os/netfront.c
> @@ -506,7 +506,7 @@ int netfront_tap_open(char *nodename) {
>  
>  void shutdown_netfront(struct netfront_dev *dev)
>  {
> -    char* err = NULL;
> +    char* err = NULL, *err2;
>      XenbusState state;
>  
>      char path[strlen(dev->backend) + strlen("/state") + 1];
> @@ -549,16 +549,21 @@ void shutdown_netfront(struct netfront_dev *dev)
>  
>  close:
>      if (err) free(err);
> -    xenbus_unwatch_path_token(XBT_NIL, path, path);
> +    err2 = xenbus_unwatch_path_token(XBT_NIL, path, path);
> +    if (err2) free(err2);
>  
>      snprintf(nodename, sizeof(nodename), "%s/tx-ring-ref", dev->nodename);
> -    xenbus_rm(XBT_NIL, nodename);
> +    err2 = xenbus_rm(XBT_NIL, nodename);
> +    if (err2) free(err2);
>      snprintf(nodename, sizeof(nodename), "%s/rx-ring-ref", dev->nodename);
> -    xenbus_rm(XBT_NIL, nodename);
> +    err2 = xenbus_rm(XBT_NIL, nodename);
> +    if (err2) free(err2);
>      snprintf(nodename, sizeof(nodename), "%s/event-channel", dev->nodename);
> -    xenbus_rm(XBT_NIL, nodename);
> +    err2 = xenbus_rm(XBT_NIL, nodename);
> +    if (err2) free(err2);
>      snprintf(nodename, sizeof(nodename), "%s/request-rx-copy", 
> dev->nodename);
> -    xenbus_rm(XBT_NIL, nodename);
> +    err2 = xenbus_rm(XBT_NIL, nodename);
> +    if (err2) free(err2);
>  
>      if (!err)
>          free_netfront(dev);
> -- 
> 1.7.10.4
> 

-- 
Samuel
As usual, this being a 1.3.x release, I haven't even compiled this
kernel yet.  So if it works, you should be doubly impressed.
(Linus Torvalds, announcing kernel 1.3.3 on the linux-kernel mailing list.)

_______________________________________________
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®.