From patchwork Tue Oct 13 02:34:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Miceli X-Patchwork-Id: 22897 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 3B1224487F2 for ; Tue, 13 Oct 2020 06:01:09 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0B00B68BB42; Tue, 13 Oct 2020 06:01:09 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-il1-f194.google.com (mail-il1-f194.google.com [209.85.166.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0001A68BADA for ; Tue, 13 Oct 2020 06:01:01 +0300 (EEST) Received: by mail-il1-f194.google.com with SMTP id y16so14556761ila.7 for ; Mon, 12 Oct 2020 20:01:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=miceli-net-au.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=8/zp7S4nz8Mo9FnQ/eeqwC2uzNt6XHoZon07HTVWN2E=; b=R8eS9SdQ5MT+pt+qA/a6vw4FKqxuwImLFml4D/8TCgMK3OB8uQFRd1MOa2QjG0uohr foI6LWWrRjT1clTM1eRUOeP8tuSC8MHnb1m+vFWevmyJ7D0jAsQH1GeA5xZj8m5EuIFc emObFbzX0M+9nr3C4U90ILdgMrZ/JRJHnqIu1cStpVgfBq8TFYbfJtB8WUVBdH+gH7uA CfMcjHBpX7sQVbG4U9joGeXcSAnSRXM98wVZ2+kXuV4RJuT4iAEabYXLJZrDbKOE5wNu H6B77vmlDjDyLs6KsR1t/2NxmjT2PqEedqEldro5fGJVbjirdImadywu6/I5gMHuKIgd WSQw== 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=8/zp7S4nz8Mo9FnQ/eeqwC2uzNt6XHoZon07HTVWN2E=; b=BgB2YA7naIaat47gFot7QCQOd5R158jlhIppqyOPdixJo/Zps6UvDXXxUISbhNUhIQ mNPS6RvNe8XyFt/gXskVPhfrEJwHP4hdkeCi6D+f9DRii2sYtY/tLxbI4RpmMVzCHf2S 0tiV07LSumGiFncimy4LufGmQV0XF+rp/iylkd5Qxld/1W/yShoMOweS2nlfKM5scIs7 4O5BfNDfo23TP0swk92n/bzarZgb3Oo9ZR9ODv5iUVaqy484YfWvaTRMJVN0uUJpk/Cj uEj7g0YbOYw03d5fwEJxh8fBKJ5ipyxXlIMOUJSO/LbZvqOLcCKzpS0QXZB8Z+YbNa/a zceA== X-Gm-Message-State: AOAM533mNyQ6g6Wis8tqozFyHFCZxBbXAlsoLUgboO9jrOwcAJDgYhXV L+x1W2Rju8a7zxAxq6cwq5+SV6CEfXFRtEzy X-Google-Smtp-Source: ABdhPJzQXAldf7gUW8FhglDZcx9RdoSE3DaoKpTmW9AB9dDihxdhBvhjvpk/AOaQmf7/Yv+Owf9x0w== X-Received: by 2002:a63:1b57:: with SMTP id b23mr14787945pgm.81.1602556500309; Mon, 12 Oct 2020 19:35:00 -0700 (PDT) Received: from edna.localdomain (119-18-3-107.771203.syd.nbn.aussiebb.net. [119.18.3.107]) by smtp.gmail.com with ESMTPSA id s4sm20163901pfu.107.2020.10.12.19.34.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 19:34:59 -0700 (PDT) From: Chris Miceli To: ffmpeg-devel@ffmpeg.org Date: Tue, 13 Oct 2020 13:34:53 +1100 Message-Id: <20201013023453.59962-1-chris@miceli.net.au> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] libavfilter/dnn_backend_native: check mem allocation 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: Chris Miceli Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" check that frame allocations return non-null. --- libavfilter/dnn/dnn_backend_native.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libavfilter/dnn/dnn_backend_native.c b/libavfilter/dnn/dnn_backend_native.c index d45e211f0c..d1eb992335 100644 --- a/libavfilter/dnn/dnn_backend_native.c +++ b/libavfilter/dnn/dnn_backend_native.c @@ -81,6 +81,14 @@ static DNNReturnType get_output_native(void *model, const char *input_name, int NativeModel *native_model = (NativeModel *)model; AVFrame *in_frame = av_frame_alloc(); AVFrame *out_frame = av_frame_alloc(); + + if (!in_frame) { + return DNN_ERROR; + } + + if (!out_frame) { + return DNN_ERROR; + } in_frame->width = input_width; in_frame->height = input_height;