[FFmpeg-cvslog] avformat/libzmq: Check return of zmq_setsockopt

Andriy Gelman git at videolan.org
Tue Jan 21 17:00:12 EET 2020


ffmpeg | branch: master | Andriy Gelman <andriy.gelman at gmail.com> | Fri Jan 10 23:25:25 2020 -0500| [1054b68a62e1ea963c0450430dd77f5fbf09a525] | committer: Michael Niedermayer

avformat/libzmq: Check return of zmq_setsockopt

Signed-off-by: Andriy Gelman <andriy.gelman at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1054b68a62e1ea963c0450430dd77f5fbf09a525
---

 libavformat/libzmq.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavformat/libzmq.c b/libavformat/libzmq.c
index d86488293f..2df55542c7 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);



More information about the ffmpeg-cvslog mailing list