linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] iio staging: fix potential resource leak in generic_buffer
@ 2012-06-25 21:13 Peter Meerwald
  2012-06-25 21:13 ` [PATCH 2/3] iio staging: fix potential memory/resource leaks in find_type_by_name() Peter Meerwald
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Peter Meerwald @ 2012-06-25 21:13 UTC (permalink / raw)
  To: linux-iio; +Cc: jic23, Peter Meerwald

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
---
 drivers/staging/iio/Documentation/iio_utils.h |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h
index c0448b3..9241288 100644
--- a/drivers/staging/iio/Documentation/iio_utils.h
+++ b/drivers/staging/iio/Documentation/iio_utils.h
@@ -158,7 +158,8 @@ inline int iioutils_get_type(unsigned *is_signed,
 				     &padint, shift);
 			if (ret < 0) {
 				printf("failed to pass scan type description\n");
-				return ret;
+				ret = -errno;
+				goto error_close_sysfsfp;
 			}
 			*be = (endianchar == 'b');
 			*bytes = padint / 8;
@@ -174,7 +175,11 @@ inline int iioutils_get_type(unsigned *is_signed,
 			free(filename);
 
 			filename = 0;
+			sysfsfp = 0;
 		}
+error_close_sysfsfp:
+	if (sysfsfp)
+		fclose(sysfsfp);
 error_free_filename:
 	if (filename)
 		free(filename);
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-06-30 12:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-25 21:13 [PATCH 1/3] iio staging: fix potential resource leak in generic_buffer Peter Meerwald
2012-06-25 21:13 ` [PATCH 2/3] iio staging: fix potential memory/resource leaks in find_type_by_name() Peter Meerwald
2012-06-25 21:13 ` [PATCH 3/3] iio staging: fix resource leak in _write_sysfs_int() Peter Meerwald
2012-06-30 12:41 ` [PATCH 1/3] iio staging: fix potential resource leak in generic_buffer Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).