lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230112110122.22973-1-yulong.zhang@metoak.net>
Date:   Thu, 12 Jan 2023 19:01:22 +0800
From:   Yulong Zhang <yulong.zhang@...oak.net>
To:     linux-iio@...r.kernel.org
Cc:     jic23@...nel.org, lars@...afoo.de, linux-kernel@...r.kernel.org,
        Yulong Zhang <yulong.zhang@...oak.net>
Subject: [PATCH] tools/iio/iio_utils:fix memory leak

1.fopen sysfsfp without fclose
2.asprintf filename without free

Signed-off-by: Yulong Zhang <yulong.zhang@...oak.net>
---
 tools/iio/iio_utils.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c
index 8d35893b2..38e9352e5 100644
--- a/tools/iio/iio_utils.c
+++ b/tools/iio/iio_utils.c
@@ -264,6 +264,8 @@ int iioutils_get_param_float(float *output, const char *param_name,
 			if (fscanf(sysfsfp, "%f", output) != 1)
 				ret = errno ? -errno : -ENODATA;
 
+			fclose(sysfsfp);
+
 			break;
 		}
 error_free_filename:
@@ -444,6 +446,7 @@ int build_channel_array(const char *device_dir, int buffer_idx,
 				count--;
 				goto error_cleanup_array;
 			}
+			free(filename);
 
 			ret = asprintf(&filename,
 				       "%s/%s_index",
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ