rocr: Fix Resource Leak

allocated memory was previously not freed in the event of an error
with rwlock initialization.

Signed-off-by: Sunday Clement <Sunday.Clement@amd.com>
이 커밋은 다음에 포함됨:
Sunday Clement 작성하고 Clement, Sunday가 2025-05-30 09:16:26 -04:00를 커밋함
1 부모 fc561ff37a
커밋 293092f32f
1 파일이 변경됨
+3 -3
+3 -3
파일 보기
@@ -717,15 +717,15 @@ SharedMutex CreateSharedMutex() {
}
#endif
pthread_rwlock_t* lock = new pthread_rwlock_t;
err = pthread_rwlock_init(lock, &attrib);
std::unique_ptr<pthread_rwlock_t> lock(new pthread_rwlock_t);
err = pthread_rwlock_init(lock.get(), &attrib);
if (err != 0) {
fprintf(stderr, "rw lock init failed: %s\n", strerror(err));
return nullptr;
}
pthread_rwlockattr_destroy(&attrib);
return lock;
return lock.release();
}
bool TryAcquireSharedMutex(SharedMutex lock) {