diff mbox series

[1/3] mini-os: fix double free() in netfront

Message ID 20200409141240.28876-2-jgross@suse.com (mailing list archive)
State New, archived
Headers show
Series mini-os: fix several double frees and memory leaks | expand

Commit Message

Jürgen Groß April 9, 2020, 2:12 p.m. UTC
Commit d225f4012d69a19 ("Save/Restore Support: Add suspend/restore
support for netfront") introduced a regression in form of freeing a
netfront device structure twice.

Fix that.

Coverity-ID: 1433637
Fixes: d225f4012d69a19 ("Save/Restore Support: Add suspend/restore support for netfront")
Signed-off-by: Juergen Gross <jgross@suse.com>
---
 netfront.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Samuel Thibault April 9, 2020, 2:33 p.m. UTC | #1
Juergen Gross, le jeu. 09 avril 2020 16:12:38 +0200, a ecrit:
> Commit d225f4012d69a19 ("Save/Restore Support: Add suspend/restore
> support for netfront") introduced a regression in form of freeing a
> netfront device structure twice.
> 
> Fix that.
> 
> Coverity-ID: 1433637
> Fixes: d225f4012d69a19 ("Save/Restore Support: Add suspend/restore support for netfront")
> Signed-off-by: Juergen Gross <jgross@suse.com>

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

> ---
>  netfront.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/netfront.c b/netfront.c
> index 50b3a57..fe7bb62 100644
> --- a/netfront.c
> +++ b/netfront.c
> @@ -584,8 +584,6 @@ void shutdown_netfront(struct netfront_dev *dev)
>      list->refcount--;
>      if (list->refcount == 0) {
>          _shutdown_netfront(dev);
> -        free(dev->nodename);
> -        free(dev);
>  
>          to_del = list;
>          if (to_del == dev_list) {
> -- 
> 2.16.4
>
diff mbox series

Patch

diff --git a/netfront.c b/netfront.c
index 50b3a57..fe7bb62 100644
--- a/netfront.c
+++ b/netfront.c
@@ -584,8 +584,6 @@  void shutdown_netfront(struct netfront_dev *dev)
     list->refcount--;
     if (list->refcount == 0) {
         _shutdown_netfront(dev);
-        free(dev->nodename);
-        free(dev);
 
         to_del = list;
         if (to_del == dev_list) {