mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Fix possible nullptr deref in ~CameraSource
This commit is contained in:
parent
8d2ae07c9f
commit
51ffd94e68
|
@ -120,10 +120,13 @@ CameraSource::~CameraSource()
|
|||
if (cctxOrig)
|
||||
avcodec_close(cctxOrig);
|
||||
|
||||
for(int i = 0; i < subscriptions; i++)
|
||||
device->close();
|
||||
if (device)
|
||||
{
|
||||
for(int i = 0; i < subscriptions; i++)
|
||||
device->close();
|
||||
device = nullptr;
|
||||
}
|
||||
|
||||
device = nullptr;
|
||||
// Memfence so the stream thread sees a nullptr device
|
||||
std::atomic_thread_fence(std::memory_order_release);
|
||||
l.unlock();
|
||||
|
|
Loading…
Reference in New Issue
Block a user