Skip to contentSkip to conversation

pc-bios/s390-ccw/net: fix a possible memory leak in get_uuid()

PATCH In review [email protected] 3 participants 3 messages Aug 14, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pc-bios/s390-ccw/net: fix a possible memory leak in get_uuid()

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

---
 pc-bios/s390-ccw/netmain.c | 1 +
 1 file changed, 1 insertion(+)
pc-bios/s390-ccw/netmain.c +1 -0
index f3542cb2cf1..f2dcc01e272 100644
@@ -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;
     }
 
Signature · 1 line
2.21.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · On 8/14/19 8:14 AM, [email protected] wrote:

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

---
 pc-bios/s390-ccw/netmain.c | 1 +
 1 file changed, 1 insertion(+)
pc-bios/s390-ccw/netmain.c +0 -0
index f3542cb2cf1..f2dcc01e272 100644

pc-bios/s390-ccw/netmain.c static const char *get_uuid(void) · line 275

Quoted 7 lines
pc-bios/s390-ccw/netmain.c +1 -0
@@ -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 on v1 1/1
#2 lore raw
In reply to [email protected]
Quoted 14 lines · On Wed, 14 Aug 2019 14:14:26 +0800 <[email protected]> wrote:

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

---
 pc-bios/s390-ccw/netmain.c | 1 +
 1 file changed, 1 insertion(+)
pc-bios/s390-ccw/netmain.c +0 -0
index f3542cb2cf1..f2dcc01e272 100644

pc-bios/s390-ccw/netmain.c static const char *get_uuid(void) · line 275

Quoted 7 lines
pc-bios/s390-ccw/netmain.c +1 -0
@@ -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;
     }