mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-05 19:35:48 +03:00
Fix memory leak in example programs
Signed-off-by: Max Fillinger <maximilian.fillinger@foxcrypto.com>
This commit is contained in:
@@ -2593,6 +2593,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",
|
||||||
@@ -2603,6 +2604,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) */
|
||||||
|
|
||||||
|
@@ -3675,6 +3675,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",
|
||||||
@@ -3685,6 +3686,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