Skip to content

Commit

Permalink
iio staging: fix resource leak in _write_sysfs_int()
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 a4d429e commit ce7b04c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/staging/iio/Documentation/iio_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ inline int _write_sysfs_int(char *filename, char *basedir, int val, int verify)
goto error_free;
}
fscanf(sysfsfp, "%d", &test);
fclose(sysfsfp);
if (test != val) {
printf("Possible failure in int write %d to %s%s\n",
val,
Expand Down Expand Up @@ -573,6 +574,7 @@ int _write_sysfs_string(char *filename, char *basedir, char *val, int verify)
goto error_free;
}
fscanf(sysfsfp, "%s", temp);
fclose(sysfsfp);
if (strcmp(temp, val) != 0) {
printf("Possible failure in string write of %s "
"Should be %s "
Expand Down

0 comments on commit ce7b04c

Please sign in to comment.