Skip to content

Commit

Permalink
Close files when seek failed
Browse files Browse the repository at this point in the history
  • Loading branch information
rovo89 committed Mar 8, 2015
1 parent aec82f1 commit 205ca32
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions xposed_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ void* looper(void* unused __attribute__((unused))) {

if (data->offset > 0 && fseek(f, data->offset, SEEK_SET) != 0) {
shared->error = ferror(f);
fclose(f);
break;
}

Expand Down Expand Up @@ -762,6 +763,7 @@ status_t XposedService::readFile(const String16& filename16, int32_t offset, int
free(*buffer);
*buffer = NULL;
status_t err = ferror(f);
fclose(f);
if (errormsg) *errormsg = formatToString16("%s during fseek() to offset %d for %s", strerror(err), offset, filename);
return ferror(f);
}
Expand Down

0 comments on commit 205ca32

Please sign in to comment.