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:44:17 +0000 (00:44 +0200)
src/lib/ffmpeg_file_encoder.cc

index cd5d473f946efb92eaf13a2840fc865b9b7ce00f..e6f38df354e7b9acab2fec78ee3252d910cf9ed4 100644 (file)
@@ -422,5 +422,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);
+       }
 }