arm-trusted-firmware/tools/cert_create/include
Masahiro Yamada 762f1ebe8d cert_create: fix memory leak bug caused by key container overwrite
In the current code, both key_load() and key_create() call key_new()
to allocate a key container (and they do not free it even if they
fail).  If a specific key is not given by the command option,
key_load() fails, then key_create() is called.  At this point, the
key container that has been allocated in key_load() is still alive,
and it is overwritten by a new key container created by key_create().

Move the key_new() call to the main() function to make sure it is
called just once for each descriptor.

While we are here, let's fix one more bug; the error handling code
  ERROR("Malloc error while loading '%s'\n", keys[i].fn);
is wrong because keys[i].fn is NULL pointer unless a specific key is
given by the command option.  This code could be run in either case.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-02-11 12:59:16 +09:00
..
tbbr TBB: apply TBBR naming convention to certificates and extensions 2015-12-14 12:29:44 +00:00
cert.h Merge pull request #484 from jcastillo-arm/jc/tf-issues/337 2016-01-13 11:42:30 +00:00
cmd_opt.h cert_create: update help message 2016-01-07 14:48:27 +00:00
debug.h TBB: add tool to generate certificates 2015-01-28 18:26:59 +00:00
ext.h cert_create: add non-volatile counter support 2016-03-30 14:46:30 +01:00
key.h cert_create: fix memory leak bug caused by key container overwrite 2017-02-11 12:59:16 +09:00
sha.h TBB: add tool to generate certificates 2015-01-28 18:26:59 +00:00