[Live-devel] Suspected memory leak

Amir Perlman amirp at tokagroup.com
Thu Jun 25 06:03:03 PDT 2020


Hi all,

I suspect there is a memory leak in the sha1 function, I appreciate it if
you can look into it.

At sha1 function in HMAC_SHA1.cpp:

static void sha1(u_int8_t* resultDigest/*must be SHA1_DIGEST_LEN bytes in
size*/,
u_int8_t const* data1, unsigned data1Length,
u_int8_t const* data2 = NULL, unsigned data2Length = 0) {
  EVP_MD_CTX* ctx = EVP_MD_CTX_create();      <-------------------------
Memory allocated
  EVP_DigestInit(ctx, EVP_sha1());
  EVP_DigestUpdate(ctx, data1, data1Length);
  if (data2 != NULL) {
    EVP_DigestUpdate(ctx, data2, data2Length);
  }
  EVP_DigestFinal(ctx, resultDigest, NULL);
  EVP_MD_CTX_destroy(ctx);       <------------------------- Not in the
original code, added to free context.
}


Thanks

-Amir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20200625/725a33c6/attachment.htm>


More information about the live-devel mailing list