struct SwsContext *sws_opts;
AVDictionary *format_opts, *codec_opts, *resample_opts;
-static const int this_year = 2014;
+static const int this_year = 2015;
void init_opts(void)
{
if (po->flags & OPT_SPEC) {
SpecifierOpt **so = dst;
char *p = strchr(opt, ':');
+ char *str;
dstcount = (int *)(so + 1);
*so = grow_array(*so, sizeof(**so), dstcount, *dstcount + 1);
- (*so)[*dstcount - 1].specifier = av_strdup(p ? p + 1 : "");
+ str = av_strdup(p ? p + 1 : "");
+ if (!str)
+ return AVERROR(ENOMEM);
+ (*so)[*dstcount - 1].specifier = str;
dst = &(*so)[*dstcount - 1].u;
}
char *str;
str = av_strdup(arg);
av_freep(dst);
+ if (!str)
+ return AVERROR(ENOMEM);
*(char **)dst = str;
} else if (po->flags & OPT_BOOL || po->flags & OPT_INT) {
*(int *)dst = parse_number_or_die(opt, arg, OPT_INT64, INT_MIN, INT_MAX);
(po->name && !strcmp(optname, po->name)))
return i;
- if (!po || po->flags & HAS_ARG)
+ if (!po->name || po->flags & HAS_ARG)
i++;
}
return 0;
av_log_set_callback(log_callback_help);
topic = av_strdup(arg ? arg : "");
+ if (!topic)
+ return AVERROR(ENOMEM);
par = strchr(topic, '=');
if (par)
*par++ = 0;
strerror(errno));
return AVERROR(errno);
}
- fseek(f, 0, SEEK_END);
- *size = ftell(f);
- fseek(f, 0, SEEK_SET);
+
+ ret = fseek(f, 0, SEEK_END);
+ if (ret == -1) {
+ ret = AVERROR(errno);
+ goto out;
+ }
+
+ ret = ftell(f);
+ if (ret < 0) {
+ ret = AVERROR(errno);
+ goto out;
+ }
+ *size = ret;
+
+ ret = fseek(f, 0, SEEK_SET);
+ if (ret == -1) {
+ ret = AVERROR(errno);
+ goto out;
+ }
+
*bufptr = av_malloc(*size + 1);
if (!*bufptr) {
av_log(NULL, AV_LOG_ERROR, "Could not allocate file buffer\n");
- fclose(f);
- return AVERROR(ENOMEM);
+ ret = AVERROR(ENOMEM);
+ goto out;
}
ret = fread(*bufptr, 1, *size, f);
if (ret < *size) {
(*bufptr)[(*size)++] = '\0';
}
+out:
fclose(f);
return ret;
}