cmdutils: add missing check for ftell() return
Fixed CID703706 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
916352f282
commit
ce739e66f4
1 changed files with 4 additions and 0 deletions
|
@ -1303,6 +1303,10 @@ int cmdutils_read_file(const char *filename, char **bufptr, size_t *size)
|
||||||
fseek(f, 0, SEEK_END);
|
fseek(f, 0, SEEK_END);
|
||||||
*size = ftell(f);
|
*size = ftell(f);
|
||||||
fseek(f, 0, SEEK_SET);
|
fseek(f, 0, SEEK_SET);
|
||||||
|
if (*size == (size_t)-1) {
|
||||||
|
av_log(NULL, AV_LOG_ERROR, "IO error: %s\n", strerror(errno));
|
||||||
|
return AVERROR(errno);
|
||||||
|
}
|
||||||
*bufptr = av_malloc(*size + 1);
|
*bufptr = av_malloc(*size + 1);
|
||||||
if (!*bufptr) {
|
if (!*bufptr) {
|
||||||
av_log(NULL, AV_LOG_ERROR, "Could not allocate file buffer\n");
|
av_log(NULL, AV_LOG_ERROR, "Could not allocate file buffer\n");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue