Skip to contentSkip to conversation

pktgen: Fix memory leak in pktgen_if_write

PATCH Applied Gustavo A. R. Silva 3 participants 3 messages Mar 14, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pktgen: Fix memory leak in pktgen_if_write

_buf_ is an array and the one that must be freed is _tp_ instead.

Fixes a870a02cc963 ("pktgen: use dynamic allocation for debug print buffer")
---
 net/core/pktgen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/pktgen.c +1 -1
index fd65761..545cf08 100644
@@ -913,7 +913,7 @@ static ssize_t pktgen_if_write(struct file *file,
 			return PTR_ERR(tp);
 
 		pr_debug("%s,%zu  buffer -:%s:-\n", name, count, tp);
-		kfree(buf);
+		kfree(tp);
 	}
 
 	if (!strcmp(name, "min_pkt_size")) {
Signature · 1 line
2.7.4
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Gustavo A. R. Silva

_buf_ is an array and the one that must be freed is _tp_ instead.

Fixes a870a02cc963 ("pktgen: use dynamic allocation for debug print buffer")

Thanks for fixing up my mistake so quickly, and thanks to Wang for the report

I was about to send the same patch, but you got there first.