OSDN Git Service

crypto: dh - fix memleak in setkey
authorTudor-Dan Ambarus <tudor.ambarus@microchip.com>
Thu, 25 May 2017 07:18:07 +0000 (10:18 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 24 Nov 2017 07:33:41 +0000 (08:33 +0100)
commit4a7e0231242040513f4b78117e83aa85028ff053
treec58c0352e0c49eb77191f62ccaadd7fb0c0c97fa
parent67b718fcf89745836ecbf15cdd46ded2b071c3b6
crypto: dh - fix memleak in setkey

commit ee34e2644a78e2561742bea8c4bdcf83cabf90a7 upstream.

setkey can be called multiple times during the existence
of the transformation object. In case of multiple setkey calls,
the old key was not freed and we leaked memory.
Free the old MPI key if any.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
crypto/dh.c