if (fseeko(ff, 0, SEEK_END) < 0) {
ast_log(LOG_ERROR, "Cannot seek to end of '%s': %s\n", args.filename, strerror(errno));
+ fclose(ff);
return -1;
}
flength = ftello(ff);
fseeko(ff, length, SEEK_END);
if ((length = ftello(ff)) - offset < 0) {
/* Eliminates all results */
+ fclose(ff);
return -1;
}
} else if (length == LLONG_MAX) {
ast_str_append_substr(buf, len, fbuf, toappend);
}
+ fclose(ff);
return 0;
}
}
}
+ fclose(ff);
return 0;
}
if (offset < 0) {
if (fseeko(ff, offset, SEEK_END)) {
ast_log(LOG_ERROR, "Cannot seek to offset: %s\n", strerror(errno));
+ fclose(ff);
+ return -1;
}
offset = ftello(ff);
}