New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak in cert_write example program #1422

Closed
hanno-arm opened this Issue Mar 6, 2018 · 1 comment

Comments

Projects
None yet
3 participants
@hanno-arm
Contributor

hanno-arm commented Mar 6, 2018

Issue: The programs/x509/cert_write example program doesn't free the CSR and issuer CRT structures csr resp. issuer_crt after use. Their initialization happens here and here, but the cleanup section omits them.

This leads to a memory leak when running programs/x509/cert_write with either the request_file or the issuer_crt argument set, as witnessed by a run with address sanitizer enabled.

@ciarmcom

This comment has been minimized.

Member

ciarmcom commented Mar 6, 2018

ARM Internal Ref: IOTSSL-2152

hanno-arm added a commit to hanno-arm/mbedtls that referenced this issue Oct 5, 2018

Fix memory leak and freeing without initialization in cert_write
* The variables `csr` and `issuer_crt` are initialized but not freed.
* The variable `entropy` is unconditionally freed in the cleanup section
  but there's a conditional jump to that section before its initialization.
  This cmmot Moves it to the other initializations happening before the
  first conditional jump to the cleanup section.

Fixes ARMmbed#1422.

hanno-arm added a commit to hanno-arm/mbedtls that referenced this issue Oct 5, 2018

Fix memory leak and freeing without initialization in cert_write
* The variables `csr` and `issuer_crt` are initialized but not freed.
* The variable `entropy` is unconditionally freed in the cleanup section
  but there's a conditional jump to that section before its initialization.
  This cmmot Moves it to the other initializations happening before the
  first conditional jump to the cleanup section.

Fixes ARMmbed#1422.

hanno-arm added a commit to hanno-arm/mbedtls that referenced this issue Oct 5, 2018

Fix memory leak and freeing without initialization in cert_write
* The variables `csr` and `issuer_crt` are initialized but not freed.
* The variable `entropy` is unconditionally freed in the cleanup section
  but there's a conditional jump to that section before its initialization.
  This cmmot Moves it to the other initializations happening before the
  first conditional jump to the cleanup section.

Fixes ARMmbed#1422.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment