Browse Source

Fix possible nullptr deref in ~CameraSource

pull/2476/head
tux3 10 years ago
parent
commit
51ffd94e68
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
  1. 9
      src/video/camerasource.cpp

9
src/video/camerasource.cpp

@ -120,10 +120,13 @@ CameraSource::~CameraSource() @@ -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…
Cancel
Save