[PATCH 8/8] staging: dgap: fix memory leak in dgap_parsefile()

Dan Carpenter dan.carpenter at oracle.com
Tue Jul 15 06:51:16 UTC 2014


On Tue, Jul 15, 2014 at 12:05:14PM +0900, Daeseok Youn wrote:
> The p->u.board.status is allocated and set a string as
> "No" once within allocating a node of BNODE type.
> But it also set again with kstrdup() in case of "STATUS"
> or "ID". If it is not allocated yet, use kstrdup().
> If not, use just memcpy().

I don't think a 2 char buffer is always large enough to hold the new
strings.

Just free it and allocate again.

regards,
dan carpenter



More information about the devel mailing list