LGTM On 1/11/20, Andriy Gelman <andriy.gel...@gmail.com> wrote: > From: Andriy Gelman <andriy.gel...@gmail.com> > > Signed-off-by: Andriy Gelman <andriy.gel...@gmail.com> > --- > libavformat/libzmq.c | 24 +++++++++++------------- > 1 file changed, 11 insertions(+), 13 deletions(-) > > diff --git a/libavformat/libzmq.c b/libavformat/libzmq.c > index 2df55542c7e..8c8b294c921 100644 > --- a/libavformat/libzmq.c > +++ b/libavformat/libzmq.c > @@ -101,16 +101,13 @@ static int zmq_proto_open(URLContext *h, const char > *uri, int flags) > s->socket = zmq_socket(s->context, ZMQ_PUB); > if (!s->socket) { > av_log(h, AV_LOG_ERROR, "Error occured during zmq_socket(): > %s\n", ZMQ_STRERROR); > - zmq_ctx_term(s->context); > - return AVERROR_EXTERNAL; > + goto fail_term; > } > > ret = zmq_bind(s->socket, uri); > if (ret == -1) { > av_log(h, AV_LOG_ERROR, "Error occured during zmq_bind(): > %s\n", ZMQ_STRERROR); > - zmq_close(s->socket); > - zmq_ctx_term(s->context); > - return AVERROR_EXTERNAL; > + goto fail_close; > } > } > > @@ -119,27 +116,28 @@ static int zmq_proto_open(URLContext *h, const char > *uri, int flags) > s->socket = zmq_socket(s->context, ZMQ_SUB); > if (!s->socket) { > av_log(h, AV_LOG_ERROR, "Error occured during zmq_socket(): > %s\n", ZMQ_STRERROR); > - zmq_ctx_term(s->context); > - return AVERROR_EXTERNAL; > + goto fail_term; > } > > 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; > + goto fail_close; > } > > ret = zmq_connect(s->socket, uri); > if (ret == -1) { > av_log(h, AV_LOG_ERROR, "Error occured during zmq_connect(): > %s\n", ZMQ_STRERROR); > - zmq_close(s->socket); > - zmq_ctx_term(s->context); > - return AVERROR_EXTERNAL; > + goto fail_close; > } > } > return 0; > + > +fail_close: > + zmq_close(s->socket); > +fail_term: > + zmq_ctx_term(s->context); > + return AVERROR_EXTERNAL; > } > > static int zmq_proto_write(URLContext *h, const unsigned char *buf, int > size) > -- > 2.24.0 > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".