mirror of
https://github.com/kdave/btrfs-progs
synced 2025-02-17 18:26:55 +00:00
Btrfs-progs: fix a small memory leak in btrfs-list.c
valgrind found this very obvious issue. Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
This commit is contained in:
parent
75c47053a4
commit
a3ed81c5e9
12
btrfs-list.c
12
btrfs-list.c
@ -577,13 +577,13 @@ static int resolve_root(struct root_lookup *rl, struct root_info *ri,
|
|||||||
|
|
||||||
add_len = strlen(found->path);
|
add_len = strlen(found->path);
|
||||||
|
|
||||||
/* room for / and for null */
|
|
||||||
tmp = malloc(add_len + 2 + len);
|
|
||||||
if (!tmp) {
|
|
||||||
perror("malloc failed");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (full_path) {
|
if (full_path) {
|
||||||
|
/* room for / and for null */
|
||||||
|
tmp = malloc(add_len + 2 + len);
|
||||||
|
if (!tmp) {
|
||||||
|
perror("malloc failed");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
memcpy(tmp + add_len + 1, full_path, len);
|
memcpy(tmp + add_len + 1, full_path, len);
|
||||||
tmp[add_len] = '/';
|
tmp[add_len] = '/';
|
||||||
memcpy(tmp, found->path, add_len);
|
memcpy(tmp, found->path, add_len);
|
||||||
|
Loading…
Reference in New Issue
Block a user