DPDK patches and discussions
 help / color / mirror / Atom feed
From: Congwen Zhang <zhang.congwen@zte.com.cn>
To: rahul.lakkireddy@chelsio.com
Cc: dev@dpdk.org, Congwen Zhang <zhang.congwen@zte.com.cn>
Subject: [dpdk-dev] [PATCH] net/cxgbe: fix memory leak
Date: Tue, 5 Sep 2017 16:46:57 +0800	[thread overview]
Message-ID: <201709050902.v8592Tm3013413@mse01.zte.com.cn> (raw)

In function t4_wr_mbox_meat_timeout(), Dynamic memory stored
in 'temp' not free when the functon return, It possible memory
leak.

Signed-off-by: Congwen Zhang <zhang.congwen@zte.com.cn>
---
 drivers/net/cxgbe/base/t4_hw.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c
index a8ccea0..013d996 100644
--- a/drivers/net/cxgbe/base/t4_hw.c
+++ b/drivers/net/cxgbe/base/t4_hw.c
@@ -403,6 +403,7 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox,
 			t4_os_atomic_list_del(&entry, &adap->mbox_list,
 					      &adap->mbox_lock);
 			t4_report_fw_error(adap);
+			free(temp);
 			return (pcie_fw & F_PCIE_FW_ERR) ? -ENXIO : -EBUSY;
 		}
 
@@ -446,6 +447,7 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox,
 							 &adap->mbox_list,
 							 &adap->mbox_lock));
 		t4_report_fw_error(adap);
+		free(temp);
 		return (v == X_MBOWNER_FW ? -EBUSY : -ETIMEDOUT);
 	}
 
@@ -546,6 +548,7 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox,
 			T4_OS_MBOX_LOCKING(
 				t4_os_atomic_list_del(&entry, &adap->mbox_list,
 						      &adap->mbox_lock));
+			free(temp);
 			return -G_FW_CMD_RETVAL((int)res);
 		}
 	}
-- 
1.8.3.1

             reply	other threads:[~2017-09-05  9:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-05  8:46 Congwen Zhang [this message]
2017-09-06  9:25 ` Rahul Lakkireddy
2017-09-06 14:44   ` Ferruh Yigit

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=201709050902.v8592Tm3013413@mse01.zte.com.cn \
    --to=zhang.congwen@zte.com.cn \
    --cc=dev@dpdk.org \
    --cc=rahul.lakkireddy@chelsio.com \
    /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).