net/tls: fixes memory leakage in easy tls api.
authorJunyeon LEE <junyeon2.lee@samsung.com>
Fri, 23 Jun 2017 14:02:53 +0000 (23:02 +0900)
committerEunBong Song <eunb.song@samsung.com>
Tue, 11 Jul 2017 11:13:45 +0000 (20:13 +0900)
This commit is to fix memory leakage in easy tls api.
Without this commit, tls_ctx and tls_session structures
are not freed and remain in memory.

Change-Id: Idea8bf2a44d1401e81f97a377a5480c580c96d92
Signed-off-by: Junyeon LEE <junyeon2.lee@samsung.com>
os/net/tls/easy_tls.c

index 7349b63..4ac2d20 100644 (file)
@@ -293,6 +293,8 @@ int TLSCtx_free(tls_ctx *ctx)
        tls_context_release(ctx);
        tls_context_free(ctx);
 
+       TLS_FREE(ctx);
+
        EASY_TLS_DEBUG("TLSCtx free\n");
        return TLS_SUCCESS;
 }
@@ -391,7 +393,9 @@ int TLSSession_free(tls_session *session)
 
        mbedtls_ssl_free(session->ssl);
        mbedtls_net_free(&session->net);
+
        TLS_FREE(session->ssl);
+       TLS_FREE(session);
 
        EASY_TLS_DEBUG("TLSSession free\n");
        return 0;