From patchwork Fri May 17 19:37:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48963 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:3a48:b0:1af:fc2d:ff5a with SMTP id zu8csp3083493pzb; Fri, 17 May 2024 12:37:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXODGeJyvOoaR9Bsxhr0RlJaQh6xCtvsV0AIjtnGccSbutGQaDO3NHLgesA8YDUsrBDpVJUsCE55D9KqogZtN2YwVz2ucVIgOpImg== X-Google-Smtp-Source: AGHT+IFKE13AMrNwJvmedxOaPWJxwBNFCrxDdxmDyGYjomKj4PGQy99tOpGejqq137gSs0ENeCR5 X-Received: by 2002:a17:906:5d1:b0:a59:be21:3587 with SMTP id a640c23a62f3a-a5d5903beb6mr7127566b.8.1715974656377; Fri, 17 May 2024 12:37:36 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a640c23a62f3a-a5a17945d5esi974164466b.16.2024.05.17.12.37.35; Fri, 17 May 2024 12:37: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; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=SAGvNveS; arc=fail (body hash mismatch); 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 30B6B68CF29; Fri, 17 May 2024 22:37:32 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01olkn2039.outbound.protection.outlook.com [40.92.65.39]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 958F768CF29 for ; Fri, 17 May 2024 22:37:25 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ayv9e3xR7RV9hMjvm6TiDT6pOM/LVeBL9TAjcCK4JUWWAY/RFwv850jCW9n239PeF2Csv6UV7hzSOmUoBAGwbueUwTM2R4ehoguNRcJUzdcbMiEe5i80j5KBlf/LlfmhLVwpmFuU9pKKd8UIpph9FzG+VCr1SEv+oH9B4xWC1LlOLF3k91gyxOeLG1jS/7/URvJViRMdj3ypiIeYLwPJNX3gPhd3l2bTrOOLHPUHqXLJOeWewDL6/ms4h+uXTshczt36yGSKGC4O8AOVWn5nOkHJly866gz1vZ+NKaljeGq7kVtoh4Wc1JD2zXCHhKkoHyBQnByyZ0z/t27VqYhzGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=stJMQiu2iaZ6iSbOaykHkGr84bZ2QIa5BGka9K1/tXo=; b=ep5p3CHtbOxnSMZINtPbB8Yz8tEVH83cfTSjafUsYB9Z5qsDbjNRkNVZapIqWAw4XMDgnHI9lDuPZLAkiZhxSa44JqgnQIbKZzEQ3OxjQ0xaA2g9VBq1kvQf5zo9kp29iaS82MzWzJ185/n0qT+TDQxZnq8NahIEnE8TIJFVc7c/7m6xhpfC7MyPV4GgpZRpBlvBHlX8znOULEv63iDIdKpXrMc7Us3x4SGXIjln/Mu0qWo1zojwjS3ILCgPjo480Pcv8W6ByKmNwNMHbYEciG9KRMCqx3rzkY7qXlE8X1rkPYKT8Q4aS8nd0S3KaTKV7DVvGUVxS7hPgKBlwonWxw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=stJMQiu2iaZ6iSbOaykHkGr84bZ2QIa5BGka9K1/tXo=; b=SAGvNveSBzjXkw6d1ffTvaiy/D3AVvZnPkmWMgoMHGQtugTbEI+9r8lN2tkpQkBkz5lGBg76Z/4JGPNgWR8t+yUFMxXfAhjcAlXd9V/m4zjkZntoyOakyHPUBFxJg3MYTmHpcGdgZEhizsM6CWyLdqokCc+yqyN4R2crCrTLXaeYMGWm9fVT5dmOp/rsO3u5xY6VP3O3H0YKWbZDjyIESsqLY9VIlxSL0lZ0MS5MGFK2WPgkCJUwQgsOip2o4wG1dEAxQQslLECBp9uOm8tOyJYI/yZ6ykA37CIYcICR94Ylw9p/NU/RzZL0uVvrdyNXbi6O1j892bZ7Kn68AF87tA== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by DU0P250MB0531.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:34f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Fri, 17 May 2024 19:37:23 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::384d:40d4:ecb7:1c9]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::384d:40d4:ecb7:1c9%4]) with mapi id 15.20.7544.052; Fri, 17 May 2024 19:37:23 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 17 May 2024 21:37:16 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 X-TMN: [CWgOfx15WLAbqvJ6FysUaF0DJ+oZItxIE0Mki8NGehM=] X-ClientProxiedBy: FR5P281CA0006.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:f2::16) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240517193716.208475-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|DU0P250MB0531:EE_ X-MS-Office365-Filtering-Correlation-Id: 756a4629-e5a9-4a8e-0dfc-08dc76a8c652 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|440099019|3412199016|1710799017; X-Microsoft-Antispam-Message-Info: Y/L0eChWc9T8JCCv270v5uiitf97jmgU4j6qbPd6xLBhvLFlpxUDcvfzd12VTEy3ElXwFekteQ1QYdiBCytcffD2wY0KcfNqzpsHHqTYVxKn4sMjWd875WcFmZp/FZB7PwwMDwpmwVvi68ZZu8lgnzwLBJCb6EH/Sz502UVuCIt6ijid+Z6OscrHkJgdqYXdw4Tbagq8RDby1AE8gLCHJ6mtT1b7SuxFZLabJpgzgiSOVlI0/Ln/bSqibwhgaqgMMA0UPbgbHC04DldBqM2E3pjJjrTBSfUVsjbParZ2OW3bKZYP0KRwz8EvTgzA7B/HhULQxzmNMXNoT9dQzZe1H9cZIHPxAD3nOmrEDColjmoSTLbXxpQ2tbaWjyC+r7TgW+xM4kPa0vOF2PT+JXVzsS5bDz7fUTGSbkGXchdoU5ftbQEZIVCGFTKax8TJ6rdENtGJrYmmZL7oIRKFOnYqybf9BYfKIgFs+y6AmlULQxTyu5tj3ofHR9ttCvnapgG3aOs1PQ/VHQpzydNNXR63Yd/JGCkKJtS53ctfG+NgWWNsEbLBRtcW0fh7DmeycOOGexeW1fVx1MOz26i2Z+ASwFZxgYn9DikA1SZYUvIJrP8NbNw9wZOcrSg9rmoHj05z X-MS-Exchange-AntiSp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E+fMp4BxpvALOIE3bflSEKAWveiyxPzq4UkXsEkxmG86cjBn5WbfYuHfoTn6EUw41h8D74AGlw7Eg1tHVjCcBWwIebx7dI718fixEfKI8iHEWJiHlPCZ0r+ShhgzeYZG5JV6PV2K3Ug4vMUrBNiTPJoAQt4VDAei6bbKWCfyp5u9eRXUcrBDGxZf7Idx3l25FCLYdf/GXHPQ5qM5CtQw81oS6Y5pp8bkMIJ/NY6NgBnUwLCJir0XlW3coAkqfWg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 756a4629-e5a9-4a8e-0dfc-08dc76a8c652 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2024 19:37:23.5408 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0P250MB0531 Subject: [FFmpeg-devel] [PATCH] avfilter/vf_dnn_detect: Fix segfault on init error 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 9y1HxPJhq2/o Signed-off-by: Andreas Rheinhardt --- libavfilter/vf_dnn_detect.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libavfilter/vf_dnn_detect.c b/libavfilter/vf_dnn_detect.c index bacea3ef29..56206d6f9f 100644 --- a/libavfilter/vf_dnn_detect.c +++ b/libavfilter/vf_dnn_detect.c @@ -808,11 +808,13 @@ static av_cold void dnn_detect_uninit(AVFilterContext *context) DnnDetectContext *ctx = context->priv; AVDetectionBBox *bbox; ff_dnn_uninit(&ctx->dnnctx); - while(av_fifo_can_read(ctx->bboxes_fifo)) { - av_fifo_read(ctx->bboxes_fifo, &bbox, 1); - av_freep(&bbox); + if (ctx->bboxes_fifo) { + while (av_fifo_can_read(ctx->bboxes_fifo)) { + av_fifo_read(ctx->bboxes_fifo, &bbox, 1); + av_freep(&bbox); + } + av_fifo_freep2(&ctx->bboxes_fifo); } - av_fifo_freep2(&ctx->bboxes_fifo); av_freep(&ctx->anchors); free_detect_labels(ctx); }