[FFmpeg-devel] [PATCH 1/2] avformat/libzmq: Check return of zmq_setsockopt
Andriy Gelman
andriy.gelman at gmail.com
Sat Jan 11 06:25:25 EET 2020
From: Andriy Gelman <andriy.gelman at gmail.com>
Signed-off-by: Andriy Gelman <andriy.gelman at gmail.com>
---
libavformat/libzmq.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/libavformat/libzmq.c b/libavformat/libzmq.c
index d86488293ff..2df55542c7e 100644
--- a/libavformat/libzmq.c
+++ b/libavformat/libzmq.c
@@ -123,7 +123,14 @@ static int zmq_proto_open(URLContext *h, const char *uri, int flags)
return AVERROR_EXTERNAL;
}
- zmq_setsockopt(s->socket, ZMQ_SUBSCRIBE, "", 0);
+ ret = zmq_setsockopt(s->socket, ZMQ_SUBSCRIBE, "", 0);
+ if (ret == -1) {
+ av_log(h, AV_LOG_ERROR, "Error occured during zmq_setsockopt(): %s\n", ZMQ_STRERROR);
+ zmq_close(s->socket);
+ zmq_ctx_term(s->context);
+ return AVERROR_EXTERNAL;
+ }
+
ret = zmq_connect(s->socket, uri);
if (ret == -1) {
av_log(h, AV_LOG_ERROR, "Error occured during zmq_connect(): %s\n", ZMQ_STRERROR);
--
2.24.0
More information about the ffmpeg-devel
mailing list