From ac00f5cedb3d29d8def0384137e52952462d0a80 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Tue, 13 Feb 2024 13:02:55 -0800 Subject: [PATCH] Free after getline(), even if fail, and catch eof() on el9 getline() allocates the space for the return value even if there is an error, so when it returns an error, we still have to free() it. In el9, when reading stdin we will get errno=0 returned (no error) when we hit the end of stdin. This behavior is different from el7/8. We don't want to throw an error here to avoid failing the test, since it doesn't. Signed-off-by: Auke Kok --- utils/src/quota.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/src/quota.c b/utils/src/quota.c index 37d69f79..e9db420f 100644 --- a/utils/src/quota.c +++ b/utils/src/quota.c @@ -385,7 +385,8 @@ static int parse_stdin_in_fn(int fd, struct scoutfs_ioctl_quota_rule *irules, si ret = getline(&line, &size, stdin); if (ret < 0) { - if (errno == ENOENT) + free(line); + if ((errno == ENOENT) || (errno == 0)) return 0; ret = -errno;