Skip to content

Commit 6dea283

Browse files
martin-gpyigaw
authored andcommitted
nvme: fix mem leak in nvme copy
Valgrind revealed a mem leak in copy_cmd() due to the copy pointer not getting freed after usage. Fix the same. Signed-off-by: Martin George <[email protected]>
1 parent c3b1f65 commit 6dea283

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

nvme.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7468,12 +7468,12 @@ static int copy_cmd(int argc, char **argv, struct command *cmd, struct plugin *p
74687468
__u32 elbatms[256] = { 0 };
74697469
__u32 elbats[256] = { 0 };
74707470

7471-
union {
7471+
_cleanup_free_ union {
74727472
struct nvme_copy_range f0[256];
74737473
struct nvme_copy_range_f1 f1[256];
74747474
struct nvme_copy_range_f2 f2[256];
74757475
struct nvme_copy_range_f3 f3[256];
7476-
} *copy;
7476+
} *copy = NULL;
74777477

74787478
struct config {
74797479
__u32 namespace_id;

0 commit comments

Comments
 (0)