From patchwork Tue Jun 1 16:50:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Robert_Bengtsson-=C3=96lund?= X-Patchwork-Id: 28035 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:b214:0:0:0:0:0 with SMTP id b20csp4020746iof; Tue, 1 Jun 2021 10:12:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymcpisuGMYKfgp4CYSy1f18Xl0BBzPG4WJRcWSNFAeex4vQpsUpGKMYYgcgsrCXNXO/jjq X-Received: by 2002:aa7:d558:: with SMTP id u24mr33773091edr.331.1622567579031; Tue, 01 Jun 2021 10:12:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622567579; cv=none; d=google.com; s=arc-20160816; b=YGugv4rOUqhT2CIJcoez+JPYoH+hVKMIY4W+RwLugeZGH7/BFTT0Tvc+6/p6noKONR ltgmTRy84NJjBdyfn7MlnwRDAf9Bv3aRu5pTr559a0Tp0NEoUpLliES4icuzlppp+jaN 1FgCmHiBbhXdi6e44wS3NQdMNYAY9FNaF5/SJ42NzCpaiweXKMpaCHPU0NaJsLcEsQdb Jo207aORT9Hj/S1dxIWP7zJlg7WSV7UylpLi8abrijbuTmx0YxNz6n3HlCIfqFdsOBci UTCJYuNLOSR8rFBYps7727Qcw3wX2C4UHeCKVRr528JhzaiKcsY2zn2XiqnTUrKb4M+H e1qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=BD5yHvwZ8Bc31lh8bvzs25cUoPxmSehp2MGvkDsYrVs=; b=QBrxXlKN5cEk5Qz+Gq8zQUxF8Dg8iM9DaFGdMkZ7o7wvTl8uD8vroKgDGivxD3M5bk jguXnwF7WZTtlqpwWEOYLBFnBCh112UBe71/mUCHdmeu69hLCS6UYSAbhR6gnzsiN+8/ O58iJvIDvVXRG5769BWQG9E0edE8Ynn3hZlRmErVMk9/lzLGoyHNiISJ0seztwK+2i79 FCxwNs4w+Gm274vQPUV6+i5/j/+Gw52C1mXnxNw8lnOqvAu/ebsJatcPLL47Vv+UjW1f 1nZgQIZqO+FlDGMssr2nkn9f6vly04+rQOZVnLxwGZyXFG9JSc6ytyLBpCkQLHinNB/4 MX6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intinor-se.20150623.gappssmtp.com header.s=20150623 header.b=LsTFvM2P; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id r23si15821888ejc.379.2021.06.01.10.12.58; Tue, 01 Jun 2021 10:12:59 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@intinor-se.20150623.gappssmtp.com header.s=20150623 header.b=LsTFvM2P; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B7E47689D6C; Tue, 1 Jun 2021 20:12:54 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1AFBD688154 for ; Tue, 1 Jun 2021 20:12:48 +0300 (EEST) Received: by mail-ed1-f51.google.com with SMTP id i13so18281021edb.9 for ; Tue, 01 Jun 2021 10:12:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intinor-se.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=9SSEIlRXoIsSbbHb+xHBM9rwhh0h4HG5wDQgqPXzwTE=; b=LsTFvM2Prwimt3Kby3W67jtIAeevo5BmHJ9+ronPrCxiA0nO+5mt340Xl/SMVPdOsf BGngfQTIKWdGcDOW4fATXwoXSMe2tlbAVBvmlS+1gmF0JkMdcneKdkkEzBoQhHN+Zvi2 IbP3qiBhGtQORApRF7T+0beryzPsu1oyY9qMd1S/QjymOkprwUeVFm1qoN6ciSXsb0aP LQdEfDKf+OkZBq0iABL++nY/v9ADA4/6Ty1YbJ8PAQUfR05yPGE1pATmFYKqpaMVq5Xq 8YJKaKuy2zC336BUGQdjW78pgHUtHyUI8W5L0/ATwGGF81Z+v3njZ1imQ7CJWR7HujiO UFig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=9SSEIlRXoIsSbbHb+xHBM9rwhh0h4HG5wDQgqPXzwTE=; b=hWIxr9KO7mF4vM4NNxg8D8BKpNkgVb697z1TWQWf/cpWMVrYYpgN+gfWQSHXW+HAM+ m7LE++gnTw5c6vpfirI/gq1DFAFXw0up4rvbtlNyXV0meg04w+NC71rTc1MGgPwCoKq0 qLmlhiyU60/jYT6yhlkiZ98WahoD/IeSYPM2AsXm2Nf4As7bnoi1tF1mT+xtGMO0XO7S dTfNWSv1ZMtU2l3JC8dmKBTrZcwIV9hBeqQ+XpZFqdg/Y+iQudgjwEAJ/Re9RbULHBiA PumIPYtlsPXdO56QycCY/YNEtn16gKYXPHwfCaatb1F/pbpz3DSVHMjpo2TBQTiONywY Q6KA== X-Gm-Message-State: AOAM532FkLnHEqdKV/USDmC2oysAWg4tJuag0rSD2H3ifsG4syGI3TvP PPw4LOH9v8IPwu97BG2s+TCO+qO44r1fmA== X-Received: by 2002:a2e:b0f2:: with SMTP id h18mr11024265ljl.244.1622566298801; Tue, 01 Jun 2021 09:51:38 -0700 (PDT) Received: from I00050.intern.intinor.se (static-213-115-198-67.sme.telenor.se. [213.115.198.67]) by smtp.gmail.com with ESMTPSA id a22sm1532386ljp.72.2021.06.01.09.51.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Jun 2021 09:51:38 -0700 (PDT) From: =?utf-8?q?Robert_Bengtsson-=C3=96lund?= To: ffmpeg-devel@ffmpeg.org Date: Tue, 1 Jun 2021 18:50:51 +0200 Message-Id: <20210601165051.13259-1-robert.bengtsson-olund@intinor.se> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avformat/http: Stop cookie_dict leaking on errors. X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: =?utf-8?q?Robert_Bengtsson-=C3=96lund?= Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Wsi69euYC6Rd This solves the memory leak reported in https://trac.ffmpeg.org/ticket/9273 Signed-off-by: Robert Bengtsson-Ă–lund --- libavformat/http.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavformat/http.c b/libavformat/http.c index 1fc95c768c..476b9a8456 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -605,6 +605,7 @@ static int http_listen(URLContext *h, const char *uri, int flags, } fail: av_dict_free(&s->chained_options); + av_dict_free(&s->cookie_dict); return ret; } @@ -645,8 +646,10 @@ static int http_open(URLContext *h, const char *uri, int flags, } ret = http_open_cnx(h, options); bail_out: - if (ret < 0) + if (ret < 0) { av_dict_free(&s->chained_options); + av_dict_free(&s->cookie_dict); + } return ret; } @@ -1763,6 +1766,7 @@ static int http_close(URLContext *h) if (s->hd) ffurl_closep(&s->hd); av_dict_free(&s->chained_options); + av_dict_free(&s->cookie_dict); return ret; }