mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-25 14:25:44 +00:00
Free X509_EXTENSIONs
Previously, we would leak these extensions as they are not freed by the stack. An except from the `sk_TYPE_free` documentation: sk_TYPE_free() frees up the sk structure. It does not free up any elements of sk. After this call sk is no longer valid. The fix is to drain the stack and free its elements before freeing the stack. sk_TYPE_pop_free does this, so we use that instead. Change-Id: Ie70c302f9dda5af1a7243f163d36e99916ee639c Signed-off-by: Jimmy Brisson <jimmy.brisson@arm.com>
This commit is contained in:
parent
32269499cc
commit
bea8019826
1 changed files with 5 additions and 0 deletions
|
@ -539,6 +539,11 @@ int main(int argc, char *argv[])
|
|||
exit(1);
|
||||
}
|
||||
|
||||
for (cert_ext = sk_X509_EXTENSION_pop(sk); cert_ext != NULL;
|
||||
cert_ext = sk_X509_EXTENSION_pop(sk)) {
|
||||
X509_EXTENSION_free(cert_ext);
|
||||
}
|
||||
|
||||
sk_X509_EXTENSION_free(sk);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue