mcelog/backport-fix-the-buf-not-freed-in-read_field.patch

24 lines
560 B
Diff
Raw Normal View History

From 775527e886a94d89ac90239ef54e1ef436956e75 Mon Sep 17 00:00:00 2001
From: huangduirong <huangduirong@huawei.com>
Date: Sat, 9 Oct 2021 16:50:08 +0800
Subject: [PATCH] fix the buf not freed in read_field
---
sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sysfs.c b/sysfs.c
index 7e7166e..018f294 100644
--- a/sysfs.c
+++ b/sysfs.c
@@ -39,7 +39,7 @@ char *read_field(char *base, char *name)
fd = open(fn, O_RDONLY);
free(fn);
if (fd < 0)
- goto bad;
+ goto bad_buf;
n = read(fd, buf, 4096);
close(fd);
if (n < 0)