[PATCH 02/32] tools:iio:generic_buffer: free dev_dir_name on exit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Make sure to free dev_dir_name in case of an error or regular exit.

Signed-off-by: Hartmut Knaack <knaack.h@xxxxxx>
---
 tools/iio/generic_buffer.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer.c
index 15f2a40..7859ee9 100644
--- a/tools/iio/generic_buffer.c
+++ b/tools/iio/generic_buffer.c
@@ -220,7 +220,7 @@ int main(int argc, char **argv)
 				       "%s-dev%d", device_name, dev_num);
 			if (ret < 0) {
 				ret = -ENOMEM;
-				goto error_ret;
+				goto error_free_dev_dir_name;
 			}
 		}
 
@@ -354,6 +354,8 @@ error_free_buf_dir_name:
 error_free_triggername:
 	if (datardytrigger)
 		free(trigger_name);
+error_free_dev_dir_name:
+	free(dev_dir_name);
 error_ret:
 	return ret;
 }
-- 
2.3.6

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux