Small fix to logging cleanup

This commit is contained in:
John Jones 2017-04-27 00:06:43 -05:00
parent 8ce1c32ec4
commit f061d03cfa
3 changed files with 7 additions and 4 deletions

View file

@ -87,7 +87,6 @@ int test_secio_handshake() {
free(decode_base64); free(decode_base64);
if (rsa_private_key != NULL) if (rsa_private_key != NULL)
libp2p_crypto_rsa_rsa_private_key_free(rsa_private_key); libp2p_crypto_rsa_rsa_private_key_free(rsa_private_key);
libp2p_logger_free();
return retVal; return retVal;
} }

View file

@ -13,6 +13,7 @@
#include "test_conn.h" #include "test_conn.h"
#include "test_record.h" #include "test_record.h"
#include "test_peer.h" #include "test_peer.h"
#include "libp2p/utils/logger.h"
const char* names[] = { const char* names[] = {
"test_public_der_to_private_der", "test_public_der_to_private_der",
@ -153,6 +154,7 @@ int main(int argc, char** argv) {
printf("All %d tests passed\n", tests_ran); printf("All %d tests passed\n", tests_ran);
} }
} }
libp2p_logger_free();
return 1; return 1;
} }

View file

@ -29,10 +29,12 @@ int libp2p_logger_initialized() {
} }
int libp2p_logger_free() { int libp2p_logger_free() {
if (logger_classes != NULL) {
for(int i = 0; i < logger_classes->total; i++) { for(int i = 0; i < logger_classes->total; i++) {
free(libp2p_utils_vector_get(logger_classes, i)); free(libp2p_utils_vector_get(logger_classes, i));
} }
libp2p_utils_vector_free(logger_classes); libp2p_utils_vector_free(logger_classes);
}
return 1; return 1;
} }