Skip to contentSkip to conversation

eal: fix memleak on device hotplug rollback

PATCH Applied Darek Stojaczyk 3 participants 3 messages Oct 31, 2018 – Nov 1, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 eal: fix memleak on device hotplug rollback

Fixes 244d5130719c ("eal: enable hotplug on multi-process")
---
 lib/librte_eal/common/hotplug_mp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
lib/librte_eal/common/hotplug_mp.c +3 -1
index b68e4cabb..7c9fcc46c 100644
@@ -243,7 +243,7 @@ static void __handle_primary_request(void *param)
 		da = calloc(1, sizeof(*da));
 		if (da == NULL) {
 			ret = -ENOMEM;
-			goto quit;
+			break;
 		}
 
 		ret = rte_devargs_parse(da, req->devargs);
@@ -266,6 +266,8 @@ static void __handle_primary_request(void *param)
 
 		ret = local_dev_remove(dev);
 quit:
+		free(da->args);
+		free(da);
 		break;
 	default:
 		ret = -EINVAL;
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines

-----Original Message-----
From: Stojaczyk, Dariusz
Sent: Wednesday, October 31, 2018 8:17 AM
To: [email protected]
Cc: Stojaczyk, Dariusz <[email protected]>; Zhang, Qi Z <[email protected]>; Burakov, Anatoly <[email protected]>
Subject: [PATCH] eal: fix memleak on device hotplug rollback

Quoted 5 lines
Fixes 244d5130719c ("eal: enable hotplug on multi-process")

Thanks
Qi

Quoted 29 lines
---
 lib/librte_eal/common/hotplug_mp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
lib/librte_eal/common/hotplug_mp.c +1 -1
index b68e4cabb..7c9fcc46c 100644
@@ -243,7 +243,7 @@ static void __handle_primary_request(void *param)
 		da = calloc(1, sizeof(*da));
 		if (da == NULL) {
 			ret = -ENOMEM;
-			goto quit;
+			break;
 		}
 
 		ret = rte_devargs_parse(da, req->devargs); @@ -266,6 +266,8 @@

static void __handle_primary_request(void *param)

lib/librte_eal/common/hotplug_mp.c +2 -1
 		ret = local_dev_remove(dev);
 quit:
+		free(da->args);
+		free(da);
 		break;
 	default:
 		ret = -EINVAL;
--

2.17.1