From patchwork Sun Aug 23 16:58:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 21852 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id B996D449CCD for ; Sun, 23 Aug 2020 19:59:28 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 973CF6897FF; Sun, 23 Aug 2020 19:59:28 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from qq.com (out203-205-221-242.mail.qq.com [203.205.221.242]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3D052688036 for ; Sun, 23 Aug 2020 19:59:21 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1598201959; bh=BRjiOvW0sF8YVC8vcbl7mL59zSYbYx0L8CkStzE+TnA=; h=From:To:Cc:Subject:Date; b=PaXNV76CeD8R+KlY1YcyjN2uo2ytIoVx4TPYVH8yRRGYPHMntFz5BNZtpp0l2PRm0 kd7w8xTFoIONmrKaWZ840YtLYM4W0p5a4UhIqVL9x2iu8VbcQD5W430HhX4rnnzPA1 F5nmULXRWQExDldn6ykCawMb0t1LtIG77IvhXoWw= Received: from localhost.localdomain ([27.46.106.103]) by newxmesmtplogicsvrszb5.qq.com (NewEsmtp) with SMTP id E8BA4AE1; Mon, 24 Aug 2020 00:58:11 +0800 X-QQ-mid: xmsmtpt1598201891t2nbh94u8 Message-ID: X-QQ-XMAILINFO: MiMibI16UaPoRLOos3+55cGk3FWEebETrGq4tVp7qG2mfqnacW41GB+0xl6Tn9 qgxzA8wdOvXNmcTRkI5bdDWm2eSn8t8K9RuykhEmIx6N+9mA+v2MgSlGevMIX0V6pYyeKIbJLN/M rT3f0+2+bCiJb9Hl3IT7JmHuLMC1V3olYkNRp+Bb41v6qE/xVOS/Zbasrduiywvxe8Xb8y+fzBeA iP3Btl+pILQgjwi6Wa6osZFQaQtkOktvsc+7gRRXOmr5YvYN8/olWeR7szZRSjif5PpTYL69YyP/ wsPD0xJahvCth6uKdVKAYEgyAsl77OFTuGuDBLEDvQh5X1hFPAvISvzVLM5/hM61Y3CLccC3qa5S 1ljM7Dx8AVcWG9J8F6P07VCmeQBHF1Dns25RRq/UhNgcSw5qk2h2bguw2veiSoxZwq4oxKmRGHhw GEIE+PJEJgCtGzlYUbwpdtnPYGkL+CsGwYPyZYX2Vivrfuyrs4oAOn80RUXf/cNrwafBamZgjc4W OhAwacAVvL0i3u6B8GKGAfYBtb4a8EDVJbDi7SxFwTaH8xuc7hebSk00lZP8mu10JF9BKOO4Zv5G +eE9AjNNNsQ+vdOIP/2rI4446UB12sVAwfCdttqbCHgnidwb7AeXazi+eax8fn9mWa90qdcvOt6N 2OTEZ90W8aElQEN14c9LoBlwfrlE7hh/lxOhhb/m3yiNlhEOJNPfXcGcGCPKDgL/3Evw== From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Mon, 24 Aug 2020 00:58:09 +0800 X-OQ-MSGID: <20200823165809.59110-1-quinkblack@foxmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avformat/http: fix memleak X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Zhao Zhili Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavformat/http.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/http.c b/libavformat/http.c index 6c39da1a8b..3d25d652d3 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -577,7 +577,7 @@ static int http_open(URLContext *h, const char *uri, int flags, "No trailing CRLF found in HTTP header. Adding it.\n"); ret = av_reallocp(&s->headers, len + 3); if (ret < 0) - return ret; + goto bail_out; s->headers[len] = '\r'; s->headers[len + 1] = '\n'; s->headers[len + 2] = '\0'; @@ -588,6 +588,7 @@ static int http_open(URLContext *h, const char *uri, int flags, return http_listen(h, uri, flags, options); } ret = http_open_cnx(h, options); +bail_out: if (ret < 0) av_dict_free(&s->chained_options); return ret;