From: Theodore Ts'o Date: Thu, 21 Jan 2021 21:01:14 +0000 (-0500) Subject: debugfs: fix double free in realloc() error path in read_list() X-Git-Tag: v1.45.7~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=12c415fb0bf4aba496d5be0516e75a54bfca6c54;p=thirdparty%2Fe2fsprogs.git debugfs: fix double free in realloc() error path in read_list() Fixes-Coverity-Bug: 1464575 Fixes-Coverity-Bug: 1464571 Signed-off-by: Theodore Ts'o --- diff --git a/debugfs/util.c b/debugfs/util.c index da3a7ef76..fb05e897b 100644 --- a/debugfs/util.c +++ b/debugfs/util.c @@ -545,10 +545,8 @@ errcode_t read_list(char *str, blk64_t **list, size_t *len) goto err; } l = realloc(lst, sizeof(blk64_t) * (ln + y - x + 1)); - if (l == NULL) { - retval = ENOMEM; - goto err; - } + if (l == NULL) + return ENOMEM; lst = l; for (; x <= y; x++) lst[ln++] = x;