Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1385941 > unrolled thread

[PATCH] Staging: wilc1000: Freed memory in case of error

Started byClaudiu Beznea <claudiu.beznea@gmail.com>
First post2016-04-25 01:10 +0200
Last post2016-04-25 01:10 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] Staging: wilc1000: Freed memory in case of error Claudiu Beznea <claudiu.beznea@gmail.com> - 2016-04-25 01:10 +0200

#1385941 — [PATCH] Staging: wilc1000: Freed memory in case of error

FromClaudiu Beznea <claudiu.beznea@gmail.com>
Date2016-04-25 01:10 +0200
Subject[PATCH] Staging: wilc1000: Freed memory in case of error
Message-ID<rrBk6-3VZ-13@gated-at.bofh.it>
This patch frees memory allocated inside wilc_wlan_txq_add_cfg_pkt()
in case wilc_wlan_txq_add_to_head() fails.

Signed-off-by: Claudiu Beznea <claudiu.beznea@gmail.com>
---
 drivers/staging/wilc1000/wilc_wlan.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index 7da3b4a..11e16d5 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -325,8 +325,11 @@ static int wilc_wlan_txq_add_cfg_pkt(struct wilc_vif *vif, u8 *buffer,
 	tqe->priv = NULL;
 	tqe->tcp_pending_ack_idx = NOT_TCP_ACK;
 
-	if (wilc_wlan_txq_add_to_head(vif, tqe))
+	if (wilc_wlan_txq_add_to_head(vif, tqe)) {
+		kfree(tqe);
 		return 0;
+	}
+
 	return 1;
 }
 
-- 
1.9.1

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web