mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-09 14:50:19 +00:00
iio staging: fix potential resource leak in generic_buffer
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
parent
6b16351acb
commit
578f737dd3
@ -157,7 +157,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;
|
||||
@ -173,7 +174,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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user