* [dpdk-dev] [PATCH v1] lib: fix coverity issues in distributor allocation
@ 2017-04-04 2:42 David Hunt
2017-04-04 12:58 ` Thomas Monjalon
0 siblings, 1 reply; 2+ messages in thread
From: David Hunt @ 2017-04-04 2:42 UTC (permalink / raw)
To: dev; +Cc: bruce.richardson, david.hunt
Coverity issue 143258: not freeing distributor instance
Coverity issue 143254: not checking return code from malloc
Fixes: 775003ad2f96 ("distributor: add new burst-capable library")
Signed-off-by: David Hunt <david.hunt@intel.com>
---
lib/librte_distributor/rte_distributor.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distributor/rte_distributor.c
index 06df13d..4725904 100644
--- a/lib/librte_distributor/rte_distributor.c
+++ b/lib/librte_distributor/rte_distributor.c
@@ -621,9 +621,14 @@ rte_distributor_create_v1705(const char *name,
if (alg_type == RTE_DIST_ALG_SINGLE) {
d = malloc(sizeof(struct rte_distributor));
+ if (d == NULL) {
+ rte_errno = ENOMEM;
+ return NULL;
+ }
d->d_v20 = rte_distributor_create_v20(name,
socket_id, num_workers);
if (d->d_v20 == NULL) {
+ free(d);
/* rte_errno will have been set */
return NULL;
}
--
2.7.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dpdk-dev] [PATCH v1] lib: fix coverity issues in distributor allocation
2017-04-04 2:42 [dpdk-dev] [PATCH v1] lib: fix coverity issues in distributor allocation David Hunt
@ 2017-04-04 12:58 ` Thomas Monjalon
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2017-04-04 12:58 UTC (permalink / raw)
To: David Hunt; +Cc: dev, bruce.richardson
2017-04-04 03:42, David Hunt:
> Coverity issue 143258: not freeing distributor instance
> Coverity issue 143254: not checking return code from malloc
>
> Fixes: 775003ad2f96 ("distributor: add new burst-capable library")
>
> Signed-off-by: David Hunt <david.hunt@intel.com>
Applied with this title:
distributor: fix creation error checks
Thanks
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-04-04 12:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-04 2:42 [dpdk-dev] [PATCH v1] lib: fix coverity issues in distributor allocation David Hunt
2017-04-04 12:58 ` Thomas Monjalon
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).