From patchwork Sun Feb 10 05:07:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Zhao X-Patchwork-Id: 12018 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 E0136448172 for ; Sun, 10 Feb 2019 07:07:34 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B892F68A877; Sun, 10 Feb 2019 07:07:34 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9A7A568A862 for ; Sun, 10 Feb 2019 07:07:28 +0200 (EET) Received: by mail-pg1-f177.google.com with SMTP id d9so3433901pgl.1 for ; Sat, 09 Feb 2019 21:07:28 -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; bh=N6P/AUN11c1D03134kdzptZFz2yTNJNUxt5ZxVaX/10=; b=dmSRT1GN0bm45GTy5LEOmmv/j+12CpEtHtK/J49ok7vSIsbkkNM7riRM1L75t4YDSC 0zmHO0tZzmvPOqsqKulwglg5wbzkgll1eUTYNEHzQJ/e+0hjmeoJExi5MuwUdQoouy47 Cpw7+3G6UI8QX/ixJP6YcsPBrTQomHtoqcrjtB+Dwx3UxDpkWQXELBSELSwEEhrI1igk i5KJVz6W647HiuPLUrpgkjRVyS7bMW+xo/E+P1DE2WxnKzuAeLGqqz51h0Pat9TpLMmc xu+Y7lm8rTHEAB4MWJcWSxJXw+6bNlwAB2yisxt6JNC4BxXGXN9/S2pGhFiql67s+WHg sX7w== 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; bh=N6P/AUN11c1D03134kdzptZFz2yTNJNUxt5ZxVaX/10=; b=AQRO0ilhhHmaIHlCCv7hOudMfv6FGcdhZPEvq0ORMTurQm+1w9/ZRKD8QY793Zdx33 tjiBBZtNp4M1RTUGWp6NKCO1/cpmhWbf/KYgwmuP2WCyshJIpd9r+zwjeWolH8n1/CC3 eMgAD3oirk6EXDLQXENDcCgiPn3YSRUk18opmvpOJKsHg9J0mmsBfXqe15IPomK9JifZ RnE6UylzkwjfnQZ01+g1k+GJFA+R1/bd8SaMWyw7/FTzBbL1Q/WYvCwjnbfo68gsV1j+ g908gWrnkJd9dJJikPezrGzhNGFj9Qe9xMj/GLS4kQBwI6ccVCWuHpK62nVcrrGT85No fREw== X-Gm-Message-State: AHQUAuZ6xole1VuFCyILa9w/Md0bK9WJseXac2bh57c0WYolG1h4ecB3 lclrnrRvqM99DG3743YAJsTlC+qT X-Google-Smtp-Source: AHgI3IZnNwbSM8dIsq8FvvDacCeS2R5Emo5jLu7z9URTMtePXqaVjdjwZ6ZrRH/BAWVlNTRaYTEgjw== X-Received: by 2002:a65:654d:: with SMTP id a13mr8562996pgw.320.1549775246021; Sat, 09 Feb 2019 21:07:26 -0800 (PST) Received: from localhost.localdomain ([47.90.47.25]) by smtp.gmail.com with ESMTPSA id q21sm8755822pfq.138.2019.02.09.21.07.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 Feb 2019 21:07:24 -0800 (PST) From: Jun Zhao To: ffmpeg-devel@ffmpeg.org Date: Sun, 10 Feb 2019 13:07:20 +0800 Message-Id: <1549775240-31806-1-git-send-email-mypopydev@gmail.com> X-Mailer: git-send-email 1.7.1 Subject: [FFmpeg-devel] [PATCH] avfilter/tests/integral: Check malloc fail before using it 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: Jun Zhao MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Need to check malloc fail before using it, so adjust the location in the code. Signed-off-by: Jun Zhao --- libavfilter/tests/integral.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libavfilter/tests/integral.c b/libavfilter/tests/integral.c index 2a8e8ff..361bfd5 100644 --- a/libavfilter/tests/integral.c +++ b/libavfilter/tests/integral.c @@ -54,6 +54,9 @@ int main(void) uint32_t *ii = av_mallocz_array(ii_h + 1, ii_lz_32 * sizeof(*ii)); uint32_t *ii2 = av_mallocz_array(ii_h + 1, ii_lz_32 * sizeof(*ii2)); + if (!ii || !ii2) + return -1; + uint32_t *ii_start = ii + ii_lz_32 + 1; // skip top 0-line and left 0-column uint32_t *ii_start2 = ii2 + ii_lz_32 + 1; // skip top 0-line and left 0-column @@ -61,9 +64,6 @@ int main(void) ff_nlmeans_init(&dsp); - if (!ii || !ii2) - return -1; - for (yoff = -e; yoff <= e; yoff++) { for (xoff = -e; xoff <= e; xoff++) { printf("xoff=%d yoff=%d\n", xoff, yoff);