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 authored and igaw committed Sep 16, 2024
1 parent b180ba6 commit 8194960
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 8194960

Please sign in to comment.