Explorar o código

codec: Plug GPU decoder memory leak

ameerj %!s(int64=4) %!d(string=hai) anos
pai
achega
15f9472b15
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      src/video_core/command_classes/codecs/codec.cpp

+ 2 - 0
src/video_core/command_classes/codecs/codec.cpp

@@ -98,6 +98,8 @@ bool Codec::CreateGpuAvDevice() {
             LOG_DEBUG(Service_NVDRV, "{} explicitly unsupported", av_hwdevice_get_type_name(type));
             continue;
         }
+        // Avoid memory leak from not cleaning up after av_hwdevice_ctx_create
+        av_buffer_unref(&av_gpu_decoder);
         const int hwdevice_res = av_hwdevice_ctx_create(&av_gpu_decoder, type, nullptr, nullptr, 0);
         if (hwdevice_res < 0) {
             LOG_DEBUG(Service_NVDRV, "{} av_hwdevice_ctx_create failed {}",