pktgen: Fix memory leak in pktgen_if_write

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

Fixes: a870a02cc9 ("pktgen: use dynamic allocation for debug print buffer")
Reported-by: Wang Jian <jianjian.wang1@gmail.com>
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Gustavo A. R. Silva 2018-03-14 03:07:27 -05:00 committed by David S. Miller
parent a870a02cc9
commit 29d1df72ce
1 changed files with 1 additions and 1 deletions

View File

@ -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")) {