From patchwork Sun Nov 10 03:54:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 16189 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 8077D4431B3 for ; Sun, 10 Nov 2019 06:02:19 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3F7DD68A215; Sun, 10 Nov 2019 06:02:19 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 64303689FF0 for ; Sun, 10 Nov 2019 06:02:13 +0200 (EET) Received: by mail-wm1-f65.google.com with SMTP id b17so1740203wmj.2 for ; Sat, 09 Nov 2019 20:02:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=kAqxHz/3I804lVNN41zEuDq83pGugC7RWkrpEePkeds=; b=l8ulCV4uX61Och+YYSxyaQlw3xtgpHM1hvrL9ATFNMGe3+2+jn3sQYyVbo5DiSLfRQ gqqpIIwQg2fQCNxbJjQHkgWp0zHyuMacbxo/VjWJnl+4msYDeWm8R9jzbcBuSFIu+tSK 2nM1t97/8ZvZCC0t03cxZS49iQ48lljHbGFxGODy/ajSk+o+n7dGiF0KjDPL0DV+KvYH p/spKXhZrN15H8Eld603j1gD/1zIb5ZySr1IkJZPCX8ivvIEV70QKysf0G2r8wD/QDrW zyhHbtUqcKqSTBT2ByJfFRtSKJ3AE6f6Gqzi5KEm5qW8QXe+0yQoxjgGbrcHX3Aj5gqY 9njQ== 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=kAqxHz/3I804lVNN41zEuDq83pGugC7RWkrpEePkeds=; b=Yw3M2dTFFh649Y+VSeAqSdinziitJbQQvQIr1JsUI8Euoq3/rPajJobacGNgtqjBCp G3O2o19fUixtc4gHIi/0k3/KEkULFsvjKvYaulsAN+nQaUkuP1JrpU3qJ1tEspVkpAH0 UpJFYaSyh1VgPfrG+cPbzqjKCZq6GgIGcPUW2HfqkiQGjP0X7sszOiMcZyWqsIyD+x+8 2liGI+h5PqO35AKZqyKtzVVGUDMkgTEyUFkTHakMdyFTvteZ215UI4tDVcC4Jbmv2U1z 42aUTBRjewQ8NTi6BjxLR9JDtSyEkeezCLzTuMZHc0w9TqH7rCYm67Jny7ak98vOFJWn 0+vw== X-Gm-Message-State: APjAAAWZ1H2upRG38gi47yMJAwMY+hz2DmI26Ofovf/Uq448z82dvYSb /Df1yfd8N9/Kz9UPc85eVIl+9sAd X-Google-Smtp-Source: APXvYqywyL1YIah/uB2m+6GxZHrCtZagFl1PRmvhMREJkj7eeJVP4UIeKew7V0HtC74sg9aGlNH2Cg== X-Received: by 2002:a1c:1fcc:: with SMTP id f195mr9554218wmf.137.1573358063280; Sat, 09 Nov 2019 19:54:23 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc08937.dynamic.kabel-deutschland.de. [188.192.137.55]) by smtp.gmail.com with ESMTPSA id o10sm11581902wrq.92.2019.11.09.19.54.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Nov 2019 19:54:22 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sun, 10 Nov 2019 04:54:00 +0100 Message-Id: <20191110035406.11500-1-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/7] avformat/dss: Use AV_DICT_DONT_STRDUP_VAL to save a malloc+memcpy 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Andreas Rheinhardt --- libavformat/dss.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libavformat/dss.c b/libavformat/dss.c index d7f9cafe47..8bc6af134e 100644 --- a/libavformat/dss.c +++ b/libavformat/dss.c @@ -103,15 +103,11 @@ static int dss_read_metadata_string(AVFormatContext *s, unsigned int offset, ret = avio_read(s->pb, value, size); if (ret < size) { - ret = ret < 0 ? ret : AVERROR_EOF; - goto exit; + av_free(value); + return ret < 0 ? ret : AVERROR_EOF; } - ret = av_dict_set(&s->metadata, key, value, 0); - -exit: - av_free(value); - return ret; + return av_dict_set(&s->metadata, key, value, AV_DICT_DONT_STRDUP_VAL); } static int dss_read_header(AVFormatContext *s)