From patchwork Thu Feb 2 23:24:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aman Karmani X-Patchwork-Id: 2415 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp383829vsb; Thu, 2 Feb 2017 15:24:49 -0800 (PST) X-Received: by 10.223.163.154 with SMTP id l26mr11124121wrb.35.1486077889857; Thu, 02 Feb 2017 15:24:49 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id v53si30390109wrb.38.2017.02.02.15.24.49; Thu, 02 Feb 2017 15:24:49 -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; dkim=neutral (body hash did not verify) header.i=@tmm1-net.20150623.gappssmtp.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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 57154680D1B; Fri, 3 Feb 2017 01:24:46 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf0-f195.google.com (mail-pf0-f195.google.com [209.85.192.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 651E46809E7 for ; Fri, 3 Feb 2017 01:24:40 +0200 (EET) Received: by mail-pf0-f195.google.com with SMTP id 19so180115pfo.3 for ; Thu, 02 Feb 2017 15:24:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tmm1-net.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id; bh=9iX7ahKDIM8FJqLjguLa2QHGeBWQrTNppY6Sdk7NlxE=; b=oLrR8OU0hve8bGqodBSiSsEDZkNxbJOGfDlAT6cDF84+yLBkRtp5FgsOiOQPdd7bbU oFocykYQEp4iQKKRgSrmS/k529pFh73N4j4Xf6MW0Z0ykZ+niyMS7oXQyFHBI67HFGBk l85y/CUO5aAV3YdBD9t3R6qM3nHxQx0lyD2QS8GTrc1RWxGwxIG/LP4P5DAI4piXckns pUUvi5CbEgKsGKsh12QzdeoAaVRzuTSKaK7Nkac70K/4xSZKL6t0S9OSew1mwf77NKcx l0p7FXF498Q+UxzEI4plzme7QlOOUsBo9tqexJoz8XZ3ZZ08nF/YQN//wBZx8zeQR96u 5ifQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=9iX7ahKDIM8FJqLjguLa2QHGeBWQrTNppY6Sdk7NlxE=; b=D3vfe4rGowqI3WhaDtnbFH6oqlXM1wCBkOJJkbCjyX/FypEaygj9AZGYxDnlp23BZW QPwgtSemuBRYjNdNkZXdhy+0tpWu0jsnKxXLoAXMCYvq9bqB04vLrlYSD4hygf/Wt3Um nqAZjVFG2kbzj9sXWNTHr8e/Gx8CFI+qhFPwwO00sPHNGtOCoiC7ziDPYFLN73Dq7EnH e4pDdb5CazK09A3aPy+5sNGEd6J59HE41IWDRurlPbNvxdKfeo3RpL/6MDXzROPhW9jX okCIqK4LtrdjY7olzKEY0fiTU5YhMt6/oKwbK1+CeZQCpLAY/m6BSpVj4REYUX6u+d+4 ON8w== X-Gm-Message-State: AIkVDXKTYIbkg5XC6G536JOWE7eqWiECpTSB2IobHxA+9fd0RpoSoJLg10bvDuOgeCwStQ== X-Received: by 10.98.30.4 with SMTP id e4mr14062607pfe.19.1486077878847; Thu, 02 Feb 2017 15:24:38 -0800 (PST) Received: from tmm1-macbook.local.net (c-73-252-174-83.hsd1.ca.comcast.net. [73.252.174.83]) by smtp.gmail.com with ESMTPSA id k76sm61199958pfg.42.2017.02.02.15.24.37 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 02 Feb 2017 15:24:38 -0800 (PST) From: Aman Gupta To: ffmpeg-devel@ffmpeg.org Date: Thu, 2 Feb 2017 15:24:33 -0800 Message-Id: <20170202232433.93162-1-ffmpeg@tmm1.net> X-Mailer: git-send-email 2.10.1 (Apple Git-78) Subject: [FFmpeg-devel] [PATCH v2] avutil/hwcontext_vaapi: fix SEGV in vaTerminate when vaInitialize fails 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: Aman Gupta MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Aman Gupta Program terminated with signal SIGSEGV, Segmentation fault. #0 0x0000000000aff8a4 in vaTerminate () #1 0x0000000000ae50ce in vaapi_device_free (ctx=) at libavutil/hwcontext_vaapi.c:882 #2 0x0000000000ae1f9e in hwdevice_ctx_free (opaque=, data=) at libavutil/hwcontext.c:66 #3 0x0000000000ad856f in buffer_replace (src=0x0, dst=0x7fffa26ef1b8) at libavutil/buffer.c:119 #4 av_buffer_unref (buf=buf@entry=0x7fffa26ef1f8) at libavutil/buffer.c:129 #5 0x0000000000ae299f in av_hwdevice_ctx_create (pdevice_ref=0x170ac50 , type=type@entry=AV_HWDEVICE_TYPE_VAAPI, device=, opts=opts@entry=0x0, flags=flags@entry=0) at libavutil/hwcontext.c:494 #6 0x0000000000400968 in vaapi_device_init (device=) at ffmpeg_vaapi.c:223 --- libavutil/hwcontext_vaapi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c index 6176bdc..0051acb 100644 --- a/libavutil/hwcontext_vaapi.c +++ b/libavutil/hwcontext_vaapi.c @@ -961,14 +961,13 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, const char *device, return AVERROR(EINVAL); } - hwctx->display = display; - vas = vaInitialize(display, &major, &minor); if (vas != VA_STATUS_SUCCESS) { av_log(ctx, AV_LOG_ERROR, "Failed to initialise VAAPI " "connection: %d (%s).\n", vas, vaErrorStr(vas)); return AVERROR(EIO); } + hwctx->display = display; av_log(ctx, AV_LOG_VERBOSE, "Initialised VAAPI connection: " "version %d.%d\n", major, minor);