Skip to content

Commit

Permalink
tree: fix tls key mem leak
Browse files Browse the repository at this point in the history
Valgrind revealed a mem leak when specifying the tls key through
both the config JSON file and the CLI. This was because memory
allocated through strdup via the nvme_get_ctrl_attr() while
fetching the tls key was not getting freed. Fix it.

Signed-off-by: Martin George <[email protected]>
  • Loading branch information
martin-gpy committed Sep 15, 2024
1 parent bdb9a83 commit 4d7eacb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/nvme/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -1887,7 +1887,9 @@ static int nvme_configure_ctrl(nvme_root_t r, nvme_ctrl_t c, const char *path,
const char *name)
{
DIR *d;
char *host_key, *ctrl_key, *tls_psk;
char *host_key, *ctrl_key;

_cleanup_free_ char *tls_psk = NULL;

d = opendir(path);
if (!d) {
Expand Down

0 comments on commit 4d7eacb

Please sign in to comment.