net: tsec: Fix memory leak in error path
authorMario Six <mario.six@gdsys.cc>
Mon, 15 Jan 2018 10:08:22 +0000 (11:08 +0100)
committerJoe Hershberger <joe.hershberger@ni.com>
Mon, 26 Feb 2018 21:28:43 +0000 (15:28 -0600)
commit5775f00e1206fd425609c26ee9a3620149e567ac
treef492e5c529199e0a5b5db77c0cc19443addf96d4
parentd38de3380d1f1a9a97bc4d94ae2e5498a7cb5df4
net: tsec: Fix memory leak in error path

tsec_initialize allocates a private driver structure using malloc.
Should the memory allocation of this private structure fail, the
function execution is aborted with a return 0, but the previously
allocated device structure is never freed, hence leaked.

Free the device structure in the error case.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
drivers/net/tsec.c