mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-29 11:41:15 +03:00
Fix memory leak in example programs
Signed-off-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
This commit is contained in:
@ -2518,6 +2518,7 @@ usage:
|
|||||||
opt.exp_label, strlen(opt.exp_label),
|
opt.exp_label, strlen(opt.exp_label),
|
||||||
NULL, 0, 0);
|
NULL, 0, 0);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
|
mbedtls_free(exported_key);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
mbedtls_printf("Exporting key of length %d with label \"%s\": 0x",
|
mbedtls_printf("Exporting key of length %d with label \"%s\": 0x",
|
||||||
@ -2528,6 +2529,7 @@ usage:
|
|||||||
}
|
}
|
||||||
mbedtls_printf("\n\n");
|
mbedtls_printf("\n\n");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
mbedtls_free(exported_key);
|
||||||
}
|
}
|
||||||
#endif /* defined(MBEDTLS_SSL_KEYING_MATERIAL_EXPORT) */
|
#endif /* defined(MBEDTLS_SSL_KEYING_MATERIAL_EXPORT) */
|
||||||
|
|
||||||
|
@ -3638,6 +3638,7 @@ handshake:
|
|||||||
opt.exp_label, strlen(opt.exp_label),
|
opt.exp_label, strlen(opt.exp_label),
|
||||||
NULL, 0, 0);
|
NULL, 0, 0);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
|
mbedtls_free(exported_key);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
mbedtls_printf("Exporting key of length %d with label \"%s\": 0x",
|
mbedtls_printf("Exporting key of length %d with label \"%s\": 0x",
|
||||||
@ -3648,6 +3649,7 @@ handshake:
|
|||||||
}
|
}
|
||||||
mbedtls_printf("\n\n");
|
mbedtls_printf("\n\n");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
mbedtls_free(exported_key);
|
||||||
}
|
}
|
||||||
#endif /* defined(MBEDTLS_SSL_KEYING_MATERIAL_EXPORT) */
|
#endif /* defined(MBEDTLS_SSL_KEYING_MATERIAL_EXPORT) */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user