Commit 578f737d authored by Peter Meerwald's avatar Peter Meerwald Committed by Jonathan Cameron

iio staging: fix potential resource leak in generic_buffer

Signed-off-by: default avatarPeter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 6b16351a
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment