qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] pc-bios/s390-ccw/net: fix a possible memory leak in get_uuid()
@ 2019-08-14  6:14 luoyifan
  2019-08-14  6:54 ` Thomas Huth
  2019-08-14  8:04 ` Cornelia Huck
  0 siblings, 2 replies; 3+ messages in thread
From: luoyifan @ 2019-08-14  6:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: borntraeger, thuth, cohuck, qemu-s390x

There is a possible memory leak in get_uuid(). Should free allocated mem
before 
return NULL.

Signed-off-by: Yifan Luo <luoyifan@cmss.chinamobile.com>
---
 pc-bios/s390-ccw/netmain.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pc-bios/s390-ccw/netmain.c b/pc-bios/s390-ccw/netmain.c
index f3542cb2cf1..f2dcc01e272 100644
--- a/pc-bios/s390-ccw/netmain.c
+++ b/pc-bios/s390-ccw/netmain.c
@@ -269,6 +269,7 @@ static const char *get_uuid(void)
                  : "d" (r0), "d" (r1), [addr] "a" (buf)
                  : "cc", "memory");
     if (cc) {
+        free(mem);
         return NULL;
     }
 
-- 
2.21.0





^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] pc-bios/s390-ccw/net: fix a possible memory leak in get_uuid()
  2019-08-14  6:14 [Qemu-devel] [PATCH] pc-bios/s390-ccw/net: fix a possible memory leak in get_uuid() luoyifan
@ 2019-08-14  6:54 ` Thomas Huth
  2019-08-14  8:04 ` Cornelia Huck
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Huth @ 2019-08-14  6:54 UTC (permalink / raw)
  To: luoyifan, qemu-devel; +Cc: borntraeger, qemu-s390x, cohuck

On 8/14/19 8:14 AM, luoyifan@cmss.chinamobile.com wrote:
> There is a possible memory leak in get_uuid(). Should free allocated mem
> before 
> return NULL.
> 
> Signed-off-by: Yifan Luo <luoyifan@cmss.chinamobile.com>
> ---
>  pc-bios/s390-ccw/netmain.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/pc-bios/s390-ccw/netmain.c b/pc-bios/s390-ccw/netmain.c
> index f3542cb2cf1..f2dcc01e272 100644
> --- a/pc-bios/s390-ccw/netmain.c
> +++ b/pc-bios/s390-ccw/netmain.c
> @@ -269,6 +269,7 @@ static const char *get_uuid(void)
>                   : "d" (r0), "d" (r1), [addr] "a" (buf)
>                   : "cc", "memory");
>      if (cc) {
> +        free(mem);
>          return NULL;
>      }
>  
> 

Thanks, I queued the patch to my s390-ccw-bios branch.

Reviewed-by: Thomas Huth <thuth@redhat.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] pc-bios/s390-ccw/net: fix a possible memory leak in get_uuid()
  2019-08-14  6:14 [Qemu-devel] [PATCH] pc-bios/s390-ccw/net: fix a possible memory leak in get_uuid() luoyifan
  2019-08-14  6:54 ` Thomas Huth
@ 2019-08-14  8:04 ` Cornelia Huck
  1 sibling, 0 replies; 3+ messages in thread
From: Cornelia Huck @ 2019-08-14  8:04 UTC (permalink / raw)
  To: luoyifan; +Cc: qemu-s390x, borntraeger, thuth, qemu-devel

On Wed, 14 Aug 2019 14:14:26 +0800
<luoyifan@cmss.chinamobile.com> wrote:

> There is a possible memory leak in get_uuid(). Should free allocated mem
> before 
> return NULL.
> 
> Signed-off-by: Yifan Luo <luoyifan@cmss.chinamobile.com>
> ---
>  pc-bios/s390-ccw/netmain.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/pc-bios/s390-ccw/netmain.c b/pc-bios/s390-ccw/netmain.c
> index f3542cb2cf1..f2dcc01e272 100644
> --- a/pc-bios/s390-ccw/netmain.c
> +++ b/pc-bios/s390-ccw/netmain.c
> @@ -269,6 +269,7 @@ static const char *get_uuid(void)
>                   : "d" (r0), "d" (r1), [addr] "a" (buf)
>                   : "cc", "memory");
>      if (cc) {
> +        free(mem);
>          return NULL;
>      }
>  

Reviewed-by: Cornelia Huck <cohuck@redhat.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-08-14 13:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-14  6:14 [Qemu-devel] [PATCH] pc-bios/s390-ccw/net: fix a possible memory leak in get_uuid() luoyifan
2019-08-14  6:54 ` Thomas Huth
2019-08-14  8:04 ` Cornelia Huck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).