From patchwork Wed Nov 24 04:11:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Jianhua X-Patchwork-Id: 31613 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp9780181iob; Tue, 23 Nov 2021 20:16:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJwSgPJIRw0gzglgx8Dc4og9TeQt9uAHrrKMAbbODVmWnINGKNC+SeELU+T9nNlJt+x3uDye X-Received: by 2002:a05:6402:430e:: with SMTP id m14mr19330124edc.93.1637727395476; Tue, 23 Nov 2021 20:16:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637727395; cv=none; d=google.com; s=arc-20160816; b=i/vOmtE44UpQ0UMUFoqs3wO+ZPl2DIjbJ7xqD88ALYyMvQSH8mcqlj9+be3ScamQs/ bzrL0duS0XTH0raXVxrA84zk8GvqoKHivTSoIZgvBs9ZOOllAHxbZ8TCnQk5mrZYZZOb Avpr60XzZ7TozRCdQYqIMgFmoCKbxkhJNXl8XHa3nkOp3RcINZQONfPlocZfihXW2Xds H1ddy6oFf41YaJPbW2ymIEC2g3ESsBsJs6M+Rm+/WcR4ZJX3VQPXUpl+NkdKBfItTr5s QvqxV1nVbxt2aitQlQZdzWaMql/21Gb+OmQ1nvVkVSzf4mUI0dTC9CXx9WVabxhJSTLx lWfg== 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:mime-version:references:in-reply-to :message-id:date:to:from:delivered-to; bh=5ijkrQn0AO5jHIcsPCDYnSRdfPgiP/5oo3b+/VPDNiE=; b=Sfofvb30miW3XkKs5hZ71Viv1I/U+BnjKF7d+WwRYibCewVnfOwDOORzN5dsuFhkOB NaMSXT3XDNYIYfDgVOcTzunCyvGhdEcx1C8BXMBg1tFAZp+FlMMd6GkCw4NILzA6dQyf XF61eXY3Neyp3zy0FT8LX5oxVPo+WrnxVieIPkQAgA3n2dMBWd4TQtayTNf/7kO+dh3k dHPt1RbQcXc5lAyM1AdqlcfBixjNcBDSwYrZw5n9nTiv3NgzQeCquiRsK5E5aeQ1sDHi jKNieULDBGWaPUM+9C1MWtMqF/Lq8UGykGVeF+mKgtR1SYB63Q3CX8+n7vgHLJ0Ew5bL DPhg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id g2si51294031ejt.760.2021.11.23.20.16.35; Tue, 23 Nov 2021 20:16:35 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 207A468AF0E; Wed, 24 Nov 2021 06:16:15 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 811CA68AEBF for ; Wed, 24 Nov 2021 06:16:06 +0200 (EET) X-IronPort-AV: E=McAfee;i="6200,9189,10177"; a="232692347" X-IronPort-AV: E=Sophos;i="5.87,258,1631602800"; d="scan'208";a="232692347" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Nov 2021 20:16:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,258,1631602800"; d="scan'208";a="509676705" Received: from chenwenbin-z390-aorus-ultra.sh.intel.com ([10.239.35.110]) by orsmga008.jf.intel.com with ESMTP; 23 Nov 2021 20:16:02 -0800 From: Wu Jianhua To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Nov 2021 12:11:53 +0800 Message-Id: <20211124041154.1090109-3-jianhua.wu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211124041154.1090109-1-jianhua.wu@intel.com> References: <20211124041154.1090109-1-jianhua.wu@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 3/4] avutil/hwcontext_vulkan: check if created before destroying the instance 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: Wu Jianhua Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: rR/jd5+d0Toa Signed-off-by: Wu Jianhua --- libavutil/hwcontext_vulkan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index 4ac1058181..644ed947f8 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -1157,7 +1157,8 @@ static void vulkan_device_free(AVHWDeviceContext *ctx) vk->DestroyDebugUtilsMessengerEXT(hwctx->inst, p->debug_ctx, hwctx->alloc); - vk->DestroyInstance(hwctx->inst, hwctx->alloc); + if (hwctx->inst) + vk->DestroyInstance(hwctx->inst, hwctx->alloc); if (p->libvulkan) dlclose(p->libvulkan);