From: David Hunt <david.hunt@intel.com>
To: dev@dpdk.org
Cc: bruce.richardson@intel.com, david.hunt@intel.com
Subject: [dpdk-dev] [PATCH v1] lib: fix coverity issues in distributor allocation
Date: Tue, 4 Apr 2017 03:42:41 +0100 [thread overview]
Message-ID: <1491273761-112722-1-git-send-email-david.hunt@intel.com> (raw)
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
next reply other threads:[~2017-04-04 9:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-04 2:42 David Hunt [this message]
2017-04-04 12:58 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1491273761-112722-1-git-send-email-david.hunt@intel.com \
--to=david.hunt@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).