From patchwork Thu Aug 2 02:03:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Liu Steven X-Patchwork-Id: 9866 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:104:0:0:0:0:0 with SMTP id c4-v6csp1506253jad; Wed, 1 Aug 2018 19:03:37 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfPGT7oMxOmW725TSgZmfhvNuy4dLr61YlahcKJJuFvxHQn8CPLJ4YawjKiKHkAmnTiIpLL X-Received: by 2002:adf:a29b:: with SMTP id s27-v6mr73950wra.100.1533175416985; Wed, 01 Aug 2018 19:03:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533175416; cv=none; d=google.com; s=arc-20160816; b=rrZ2Qv9zvmPtLxwCtnbbaqPN1OSO2+N8l8L0X59TBbKrHFqBJepWl+YBHgYEJCdUd+ 5zBjuid0+SilcmriR53hTdN67EeuuTsikGlkpef1nzp44BRkrfMVXIII3lhMU+SSkcw2 deGuO3gv2JrwdA9biH+ISrpJslEKACQtJf5qFDnLxfCsY7PUsrJdd33/lt3H8yidEVuv SAt8c2pG8jS6R1vZkCdDvrUH34pkf84ARCIjRq7yDymbjZ9hiRqyArUxHhkNOEOyUBPN oxrehbx+ukau7EuGVP6O2FZv49/sKYhM8b0A9j4RKuSGXV1v8jJ77KDRpnywKAL+MGVU O0Ww== 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:feedback-id:to:references:message-id :date:in-reply-to:from:mime-version:delivered-to :arc-authentication-results; bh=fzyK0qjXVW7KsOHrOx8lBYr5Y2bHTFbI9RLkAXWc/cY=; b=Wr5tBTe23DjSR+uXbUwotToAv2T5LesnibSNEIas2VzCfHIeveBvE6uFNfLZcrXJB0 rFVFOWm/W1nSXlvDQzZ0Jdk9d6coRUzGi/+JyYprP27sTlPNYAHaLeEQ1C5BaZaTV4jV BVPfM2Z6duxlCFW+TI0bnWHuhI6cPco5JLVj/C/6MF3nQzCY+wbKwRecCKY03Wng6D9t FF+4Q6KFx+KGV6BUViJ9q9UWEoqn/qdeJlFjyyLZwqUIyRZU3CoQrTPsj00iBXLt4zxh LqjZcl16ceJKezmeyoRJVorYr5syInjtEUJGfxtvfl2g2d3cFP/lm6QQUnJ9sYOKGSnL 5WqA== ARC-Authentication-Results: i=1; mx.google.com; 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 h24-v6si303821wmc.132.2018.08.01.19.03.36; Wed, 01 Aug 2018 19:03:36 -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; 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 A2ACF68A53E; Thu, 2 Aug 2018 05:03:16 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpbgeu1.qq.com (smtpbgeu1.qq.com [52.59.177.22]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3D8EF68A53E for ; Thu, 2 Aug 2018 05:03:14 +0300 (EEST) X-QQ-mid: bizesmtp17t1533175397tvrx4in0 Received: from [172.16.0.16] (unknown [36.102.208.210]) by esmtp6.qq.com (ESMTP) with id ; Thu, 02 Aug 2018 10:03:16 +0800 (CST) X-QQ-SSF: 00100000008000F0FLF1000A0000000 X-QQ-FEAT: 6Kk0pO7nFLhWmCdPpQM5Qx36NUei8lnWi7uDHF+YrVWuOgQoUCRgyD91wUceR jgHHohVhOhzVIw7Oi0n23H3jSqKKb8n8QbOdp3QJbPrUN+5vCNWOprj/LuuLQ8qyZ3cZ+oq CHN4ICefRqqi5MQkAFa2SzIF18Oo7ZUZnHMOh6yrsme/3t7yamOYgtbJCCJDfeZdOwt/GeJ PZYjz+A1CL+VHvl0dzoD+HddwCOY/xcm55quZM5q2szErQcI6vkHAIs1+BcCqNSTIvYo6Xt osX5yG93s47rExpGMtAusD8LBhI7G/ygSbcBrlprLZR4p+ X-QQ-GoodBg: 0 Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) From: Liu Steven In-Reply-To: Date: Thu, 2 Aug 2018 10:03:12 +0800 Message-Id: <55C74722-66F1-47C7-BC27-842F3C9DE4FE@chinaffmpeg.org> References: To: FFmpeg development discussions and patches X-Mailer: Apple Mail (2.3445.6.18) X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:chinaffmpeg.org:qybgforeign:qybgforeign2 X-QQ-Bgrelay: 1 Subject: Re: [FFmpeg-devel] lavf/dashdec: 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: Liu Steven Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" > 在 2018年8月1日,下午6:03,jacek jogo 写道: > > Hi. > This fix memleak in dashdec. > ==5033== HEAP SUMMARY: > ==5033== in use at exit: 86,144 bytes in 2,848 blocks > ==5033== total heap usage: 10,089 allocs, 7,241 frees, 38,902,613 bytes > allocated > ==5033== > ==5033== Searching for pointers to 2,848 not-freed blocks > ==5033== Checked 9,139,304 bytes > ==5033== > ==5033== 528 bytes in 8 blocks are definitely lost in loss record 187 of 222 > ==5033== at 0x4C2CB5F: malloc (vg_replace_malloc.c:299) > ==5033== by 0x6868D38: xmlBufCreateSize (in /usr/lib64/libxml2.so.2.9.8) > ==5033== by 0x67F1029: xmlNodeGetContent (in /usr/lib64/libxml2.so.2.9.8) > ==5033== by 0x41EA43: resolve_content_path (dashdec.c:757) > ==5033== by 0x41EA43: parse_manifest_representation (dashdec.c:873) > ==5033== by 0x41EA43: parse_manifest_adaptationset (dashdec.c:1095) > ==5033== by 0x41EA43: parse_manifest (dashdec.c:1272) > ==5033== by 0x420E2A: dash_read_header (dashdec.c:1927) > ==5033== by 0x53CF77: avformat_open_input (utils.c:631) > ==5033== by 0x2647F4: open_input_file (ffmpeg_opt.c:1069) > ==5033== by 0x266121: open_files (ffmpeg_opt.c:3219) > ==5033== by 0x266121: ffmpeg_parse_options (ffmpeg_opt.c:3259) > ==5033== by 0x25E991: main (ffmpeg.c:4859) > ==5033== > ==5033== LEAK SUMMARY: > ==5033== definitely lost: 528 bytes in 8 blocks > ==5033== indirectly lost: 0 bytes in 0 blocks > ==5033== possibly lost: 0 bytes in 0 blocks > ==5033== still reachable: 85,616 bytes in 2,840 blocks > ==5033== suppressed: 0 bytes in 0 blocks > ==5033== Reachable blocks (those to which a pointer was found) are not > shown. > ==5033== To see them, rerun with: --leak-check=full --show-leak-kinds=all > ==5033== > ==5033== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) > ==5033== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) > > Can be reproduced with: valgrind --leak-check=full -v ffmpeg -i > http://yt-dash-mse-test.commondatastorage.googleapis.com/media/motion-20120802-manifest.mpd > <0001-lavf-dashdec-Fix-memleak.patch>_______________________________________________ what about modify --- libavformat/dashdec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 89f3ac2759..010a2e8387 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -754,9 +754,12 @@ static int resolve_content_path(AVFormatContext *s, const char *url, int *max_ur if (!(node = baseurl_nodes[rootId])) { continue; } - if (ishttp(xmlNodeGetContent(node))) { + text = xmlNodeGetContent(node); + if (ishttp(text)) { + xmlFree(text); break; } + xmlFree(text); } node = baseurl_nodes[rootId]; -- 2.18.0 to From 1fa3d049a17dd4d135bb79423e0551ee7ee7f25d Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Wed, 1 Aug 2018 11:53:41 +0200 Subject: [PATCH] lavf/dashdec: Fix memleak --- libavformat/dashdec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 89f3ac2759..010a2e8387 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -754,9 +754,12 @@ static int resolve_content_path(AVFormatContext *s, const char *url, int *max_ur if (!(node = baseurl_nodes[rootId])) { continue; } - if (ishttp(xmlNodeGetContent(node))) { + text = xmlNodeGetContent(node); + xmlFree(text); + if (ishttp(text)) { break; } } node = baseurl_nodes[rootId]; -- 2.18.0