Skip to content

Commit 542685c

Browse files
committed
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 438304a commit 542685c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

nvme.c

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

7449-
union {
7449+
_cleanup_free_ union {
74507450
struct nvme_copy_range f0[256];
74517451
struct nvme_copy_range_f1 f1[256];
74527452
struct nvme_copy_range_f2 f2[256];
74537453
struct nvme_copy_range_f3 f3[256];
7454-
} *copy;
7454+
} *copy = NULL;
74557455

74567456
struct config {
74577457
__u32 namespace_id;

0 commit comments

Comments
 (0)