From 0cbc640aad7ff38fe186826ea0118efd8509c186 Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Thu, 9 Feb 2017 15:39:55 -0700 Subject: [PATCH] memory managment in crl.c with crl monitor --- src/crl.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/crl.c b/src/crl.c index 2fbcde08c..8d3729ec1 100644 --- a/src/crl.c +++ b/src/crl.c @@ -873,9 +873,19 @@ int LoadCRL(WOLFSSL_CRL* crl, const char* path, int type, int monitor) pathBuf[pathLen] = '\0'; /* Null Terminate */ if (type == SSL_FILETYPE_PEM) { + /* free old path before setting a new one */ + if (crl->monitors[0].path) { + XFREE(crl->monitors[0].path, crl->heap, + DYNAMIC_TYPE_CRL_MONITOR); + } crl->monitors[0].path = pathBuf; crl->monitors[0].type = SSL_FILETYPE_PEM; } else { + /* free old path before setting a new one */ + if (crl->monitors[1].path) { + XFREE(crl->monitors[1].path, crl->heap, + DYNAMIC_TYPE_CRL_MONITOR); + } crl->monitors[1].path = pathBuf; crl->monitors[1].type = SSL_FILETYPE_ASN1; }