Home
last modified time | relevance | path

Searched hist:"762 f1ebe8d1b26e78cd4923f832a611c8a5f0a89" (Results 1 – 3 of 3) sorted by relevance

/rk3399_ARM-atf/tools/cert_create/include/
H A Dkey.h762f1ebe8d1b26e78cd4923f832a611c8a5f0a89 Mon Feb 06 12:15:01 UTC 2017 Masahiro Yamada <yamada.masahiro@socionext.com> 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>
/rk3399_ARM-atf/tools/cert_create/src/
H A Dkey.c762f1ebe8d1b26e78cd4923f832a611c8a5f0a89 Mon Feb 06 12:15:01 UTC 2017 Masahiro Yamada <yamada.masahiro@socionext.com> 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>
H A Dmain.c762f1ebe8d1b26e78cd4923f832a611c8a5f0a89 Mon Feb 06 12:15:01 UTC 2017 Masahiro Yamada <yamada.masahiro@socionext.com> 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>