summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavdevice/v4l2.c3
-rw-r--r--libavfilter/af_asetnsamples.c5
-rw-r--r--libavfilter/formats.c4
-rw-r--r--libavutil/opt.c7
4 files changed, 11 insertions, 8 deletions
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 284b495cd9..34e3d9cf42 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -949,11 +949,10 @@ static int v4l2_read_header(AVFormatContext *s1)
}
if (!s->width && !s->height) {
- struct v4l2_format fmt;
+ struct v4l2_format fmt = { .type = V4L2_BUF_TYPE_VIDEO_CAPTURE };
av_log(s1, AV_LOG_VERBOSE,
"Querying the device for the current frame size\n");
- fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (v4l2_ioctl(s->fd, VIDIOC_G_FMT, &fmt) < 0) {
res = AVERROR(errno);
av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_G_FMT): %s\n", av_err2str(res));
diff --git a/libavfilter/af_asetnsamples.c b/libavfilter/af_asetnsamples.c
index 08e5279989..e004453642 100644
--- a/libavfilter/af_asetnsamples.c
+++ b/libavfilter/af_asetnsamples.c
@@ -171,9 +171,8 @@ static int request_frame(AVFilterLink *outlink)
} while (!asns->req_fullfilled && ret >= 0);
if (ret == AVERROR_EOF) {
- do {
- ret = push_samples(outlink);
- } while (ret > 0);
+ ret = push_samples(outlink);
+ return ret < 0 ? ret : ret > 0 ? 0 : AVERROR_EOF;
}
return ret;
diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index 43718e4655..ea2462793e 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -184,6 +184,10 @@ AVFilterChannelLayouts *ff_merge_channel_layouts(AVFilterChannelLayouts *a,
for (i = j = 0; i < b->nb_channel_layouts; i++)
if (KNOWN(b->channel_layouts[i]))
b->channel_layouts[j++] = b->channel_layouts[i];
+ /* Not optimal: the unknown layouts of b may become known after
+ another merge. */
+ if (!j)
+ return NULL;
b->nb_channel_layouts = j;
}
MERGE_REF(b, a, channel_layouts, AVFilterChannelLayouts, fail);
diff --git a/libavutil/opt.c b/libavutil/opt.c
index fb3b724bd6..ab73913a39 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -420,8 +420,8 @@ int av_opt_set_bin(void *obj, const char *name, const uint8_t *val, int len, int
if (o->type != AV_OPT_TYPE_BINARY)
return AVERROR(EINVAL);
- ptr = av_malloc(len);
- if (!ptr)
+ ptr = len ? av_malloc(len) : NULL;
+ if (len && !ptr)
return AVERROR(ENOMEM);
dst = (uint8_t **)(((uint8_t *)target_obj) + o->offset);
@@ -430,7 +430,8 @@ int av_opt_set_bin(void *obj, const char *name, const uint8_t *val, int len, int
av_free(*dst);
*dst = ptr;
*lendst = len;
- memcpy(ptr, val, len);
+ if (len)
+ memcpy(ptr, val, len);
return 0;
}