1
0
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:
tux3 2015-10-23 20:30:22 +02:00
parent 8d2ae07c9f
commit 51ffd94e68
No known key found for this signature in database
GPG Key ID: 7E086DD661263264

View File

@ -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();