Skip to content

Commit

Permalink
Fixing memory leak by freeing memory allocated by strdup in cert_t
Browse files Browse the repository at this point in the history
  • Loading branch information
Gowrima committed Oct 29, 2024
1 parent 422bee7 commit 519512c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions zookeeper-client/zookeeper-client-c/src/zookeeper.c
Original file line number Diff line number Diff line change
Expand Up @@ -1324,8 +1324,8 @@ static zhandle_t *zookeeper_init_internal(const char *host, watcher_fn watcher,
if (cert) {
zh->fd->cert = calloc(1, sizeof(zcert_t));
memcpy(zh->fd->cert, cert, sizeof(zcert_t));
free(cert.certstr);
free(cert.ca);
free(cert->certstr);
free(cert->ca);
}

#ifdef _WIN32
Expand Down

0 comments on commit 519512c

Please sign in to comment.