From: Joo Aun Saw <jasaw@xxxxxxxxxxx> On error, caller's ci_array is freed and set to NULL to avoid potential double free. Counter is reset to zero for consistency. Signed-off-by: Joo Aun Saw <jasaw@xxxxxxxxxxx> --- tools/iio/iio_utils.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c index 1dcdf03..8731905 100644 --- a/tools/iio/iio_utils.c +++ b/tools/iio/iio_utils.c @@ -529,6 +529,8 @@ error_cleanup_array: free((*ci_array)[i].generic_name); } free(*ci_array); + *ci_array = NULL; + *counter = 0; error_close_dir: if (dp) if (closedir(dp) == -1) -- 1.9.1 -- 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