onevpl: Fix missing mutex init in sample common

Fix regression 15010791475

Signed-off-by: Yew, Chang Ching <chang.ching.yew@intel.com>
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
This commit is contained in:
Yew, Chang Ching 2022-03-02 08:30:25 +08:00 committed by Anuj Mittal
parent 07189850ab
commit c95e1f7f3c
2 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,48 @@
From f6f9d62817d58909fe9eafa555b1638f165dc746 Mon Sep 17 00:00:00 2001
From: "Yew, Chang Ching" <chang.ching.yew@intel.com>
Date: Wed, 2 Mar 2022 07:56:57 +0800
Subject: [PATCH] sample_common: Fix regression of missing mutex init
Upstream-Status: Submitted
innersource PR #377
Signed-off-by: Yew, Chang Ching <chang.ching.yew@intel.com>
---
tools/legacy/sample_common/src/vm/thread_linux.cpp | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/tools/legacy/sample_common/src/vm/thread_linux.cpp b/tools/legacy/sample_common/src/vm/thread_linux.cpp
index 819d811f..c17ce5bf 100644
--- a/tools/legacy/sample_common/src/vm/thread_linux.cpp
+++ b/tools/legacy/sample_common/src/vm/thread_linux.cpp
@@ -22,6 +22,13 @@ MSDKSemaphore::MSDKSemaphore(mfxStatus& sts, mfxU32 count) : msdkSemaphoreHandle
// If pthread_cond_init reports an error m_semaphore was not allocated
throw std::bad_alloc();
}
+ res = pthread_mutex_init(&m_mutex, NULL);
+ if (res) {
+ if (!pthread_cond_destroy(&m_semaphore)) {
+ // do nothing
+ }
+ throw std::bad_alloc();
+ }
}
MSDKSemaphore::~MSDKSemaphore(void) {
@@ -97,6 +104,13 @@ MSDKEvent::MSDKEvent(mfxStatus& sts, bool manual, bool state) : msdkEventHandle(
//non-zero means something is wrong, throw bad_alloc
throw std::bad_alloc();
}
+ res = pthread_mutex_init(&m_mutex, NULL);
+ if (res) {
+ if (!pthread_cond_destroy(&m_event)) {
+ // do nothing
+ }
+ throw std::bad_alloc();
+ }
}
MSDKEvent::~MSDKEvent(void) {
--
2.17.1

View File

@ -13,6 +13,7 @@ SRC_URI = "git://github.com/oneapi-src/oneVPL.git;protocol=https;branch=master \
file://0001-samples-Addin-wayland-scanner-auto-generate-on-cmake.patch \ file://0001-samples-Addin-wayland-scanner-auto-generate-on-cmake.patch \
file://0002-sample_misc-Addin-basic-wayland-dmabuf-support.patch \ file://0002-sample_misc-Addin-basic-wayland-dmabuf-support.patch \
file://0003-sample_misc-use-wayland-dmabuf-to-render-nv12.patch \ file://0003-sample_misc-use-wayland-dmabuf-to-render-nv12.patch \
file://0001-sample_common-Fix-regression-of-missing-mutex-init.patch \
" "
SRCREV = "efc259f8b7ee5c334bca1a904a503186038bbbdd" SRCREV = "efc259f8b7ee5c334bca1a904a503186038bbbdd"
S = "${WORKDIR}/git" S = "${WORKDIR}/git"