[v2] eal: fix IPC memleak on device hotplug
Checks
Commit Message
rte_mp_request_sync() says that the caller is responsible
for freeing one of its parameters afterwards. EAL didn't
do that, causing a memory leak.
Fixes: 244d5130719c ("eal: enable hotplug on multi-process")
Cc: qi.z.zhang@intel.com
Cc: anatoly.burakov@intel.com
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
---
lib/librte_eal/common/hotplug_mp.c | 3 +++
1 file changed, 3 insertions(+)
Comments
On 29-Oct-18 11:47 AM, Darek Stojaczyk wrote:
> rte_mp_request_sync() says that the caller is responsible
> for freeing one of its parameters afterwards. EAL didn't
> do that, causing a memory leak.
>
> Fixes: 244d5130719c ("eal: enable hotplug on multi-process")
> Cc: qi.z.zhang@intel.com
> Cc: anatoly.burakov@intel.com
>
> Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
> ---
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
30/10/2018 11:15, Burakov, Anatoly:
> On 29-Oct-18 11:47 AM, Darek Stojaczyk wrote:
> > rte_mp_request_sync() says that the caller is responsible
> > for freeing one of its parameters afterwards. EAL didn't
> > do that, causing a memory leak.
> >
> > Fixes: 244d5130719c ("eal: enable hotplug on multi-process")
> > Cc: qi.z.zhang@intel.com
> > Cc: anatoly.burakov@intel.com
> >
> > Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
>
> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Applied, thanks
@@ -355,6 +355,7 @@ int eal_dev_hotplug_request_to_primary(struct eal_dev_mp_req *req)
resp = (struct eal_dev_mp_req *)mp_reply.msgs[0].param;
req->result = resp->result;
+ free(mp_reply.msgs);
return ret;
}
@@ -379,6 +380,7 @@ int eal_dev_hotplug_request_to_secondary(struct eal_dev_mp_req *req)
if (mp_reply.nb_sent != mp_reply.nb_received) {
RTE_LOG(ERR, EAL, "not all secondary reply\n");
+ free(mp_reply.msgs);
return -1;
}
@@ -397,6 +399,7 @@ int eal_dev_hotplug_request_to_secondary(struct eal_dev_mp_req *req)
}
}
+ free(mp_reply.msgs);
return 0;
}