QEMU-Devel Archive on lore.kernel.org
 help / color / 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	[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, back to index

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

QEMU-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/qemu-devel/0 qemu-devel/git/0.git
	git clone --mirror https://lore.kernel.org/qemu-devel/1 qemu-devel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 qemu-devel qemu-devel/ https://lore.kernel.org/qemu-devel \
		qemu-devel@nongnu.org qemu-devel@archiver.kernel.org
	public-inbox-index qemu-devel


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.nongnu.qemu-devel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox