Skip to content

Commit

Permalink
iio staging: fix potential resource leak in generic_buffer
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
  • Loading branch information
Peter Meerwald authored and Jonathan Cameron committed Jun 30, 2012
1 parent 6b16351 commit 578f737
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/staging/iio/Documentation/iio_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit 578f737

Please sign in to comment.