* [PATCH 1/2] e2freefrag: fix memory leak in scan_online()
@ 2019-01-15 13:42 Lukas Czerner
2019-01-15 13:42 ` [PATCH 2/2] e2fsprogs: fix potential memory leak in path_append() Lukas Czerner
2019-02-11 16:53 ` [PATCH 1/2] e2freefrag: fix memory leak in scan_online() Theodore Y. Ts'o
0 siblings, 2 replies; 4+ messages in thread
From: Lukas Czerner @ 2019-01-15 13:42 UTC (permalink / raw)
To: linux-ext4
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
---
misc/e2freefrag.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/misc/e2freefrag.c b/misc/e2freefrag.c
index f7fede54..935ae225 100644
--- a/misc/e2freefrag.c
+++ b/misc/e2freefrag.c
@@ -236,6 +236,7 @@ static int scan_online(ext2_filsys fs, struct chunk_info *info,
fsmap_advance(fsmap);
}
+ free(fsmap);
return 1;
}
#else
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] e2fsprogs: fix potential memory leak in path_append()
2019-01-15 13:42 [PATCH 1/2] e2freefrag: fix memory leak in scan_online() Lukas Czerner
@ 2019-01-15 13:42 ` Lukas Czerner
2019-02-11 17:55 ` Theodore Y. Ts'o
2019-02-11 16:53 ` [PATCH 1/2] e2freefrag: fix memory leak in scan_online() Theodore Y. Ts'o
1 sibling, 1 reply; 4+ messages in thread
From: Lukas Czerner @ 2019-01-15 13:42 UTC (permalink / raw)
To: linux-ext4
If realloc() fails in path_append() we will lose a memory pointed to by
target->path. Fix it.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
---
misc/create_inode.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/misc/create_inode.c b/misc/create_inode.c
index 05aa6363..cedbba52 100644
--- a/misc/create_inode.c
+++ b/misc/create_inode.c
@@ -704,10 +704,12 @@ struct file_info {
static errcode_t path_append(struct file_info *target, const char *file)
{
if (strlen(file) + target->path_len + 1 > target->path_max_len) {
+ void *p;
target->path_max_len *= 2;
- target->path = realloc(target->path, target->path_max_len);
- if (!target->path)
+ p = realloc(target->path, target->path_max_len);
+ if (p == NULL)
return EXT2_ET_NO_MEMORY;
+ target->path = p;
}
target->path_len += sprintf(target->path + target->path_len, "/%s",
file);
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] e2freefrag: fix memory leak in scan_online()
2019-01-15 13:42 [PATCH 1/2] e2freefrag: fix memory leak in scan_online() Lukas Czerner
2019-01-15 13:42 ` [PATCH 2/2] e2fsprogs: fix potential memory leak in path_append() Lukas Czerner
@ 2019-02-11 16:53 ` Theodore Y. Ts'o
1 sibling, 0 replies; 4+ messages in thread
From: Theodore Y. Ts'o @ 2019-02-11 16:53 UTC (permalink / raw)
To: Lukas Czerner; +Cc: linux-ext4
On Tue, Jan 15, 2019 at 02:42:02PM +0100, Lukas Czerner wrote:
> Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Thanks, applied.
- Ted
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] e2fsprogs: fix potential memory leak in path_append()
2019-01-15 13:42 ` [PATCH 2/2] e2fsprogs: fix potential memory leak in path_append() Lukas Czerner
@ 2019-02-11 17:55 ` Theodore Y. Ts'o
0 siblings, 0 replies; 4+ messages in thread
From: Theodore Y. Ts'o @ 2019-02-11 17:55 UTC (permalink / raw)
To: Lukas Czerner; +Cc: linux-ext4
On Tue, Jan 15, 2019 at 02:42:03PM +0100, Lukas Czerner wrote:
> If realloc() fails in path_append() we will lose a memory pointed to by
> target->path. Fix it.
>
> Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Thanks, applied.
- Ted
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-02-11 17:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-15 13:42 [PATCH 1/2] e2freefrag: fix memory leak in scan_online() Lukas Czerner
2019-01-15 13:42 ` [PATCH 2/2] e2fsprogs: fix potential memory leak in path_append() Lukas Czerner
2019-02-11 17:55 ` Theodore Y. Ts'o
2019-02-11 16:53 ` [PATCH 1/2] e2freefrag: fix memory leak in scan_online() Theodore Y. Ts'o
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.