Prevent calls to erase with invalid keys.
authorCarl Hetherington <cth@carlh.net>
Fri, 25 Oct 2019 22:43:35 +0000 (00:43 +0200)
committerCarl Hetherington <cth@carlh.net>
Fri, 25 Oct 2019 22:46:08 +0000 (00:46 +0200)
src/lib/ffmpeg_file_encoder.cc

index 5eccb8f1728966fd638c57f1bad1fb48d8ee8096..d7a56f01eb95ccb311bd15c1e883c525e9e08ac5 100644 (file)
@@ -378,5 +378,8 @@ FFmpegFileEncoder::buffer_free (void* opaque, uint8_t* data)
 void
 FFmpegFileEncoder::buffer_free2 (uint8_t* data)
 {
-       _pending_images.erase (data);
+       /* XXX: does this need a lock to prevent cross-thread access to _pending_images? */
+       if (_pending_images.find(data) != _pending_images.end()) {
+               _pending_images.erase (data);
+       }
 }