mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
tools: iio: Set caller's ci_array pointer to NULL after free
On error, caller's ci_array is freed and set to NULL to avoid potential double free if some other user of this code is not sufficiently careful. Counter is reset to zero for consistency. Signed-off-by: Joo Aun Saw <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
This commit is contained in:
parent
bdb25b0af8
commit
6b20f40679
1 changed files with 2 additions and 0 deletions
|
|
@ -526,6 +526,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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue