diff options
author | repojohnray <8113421+repojohnray@users.noreply.github.com> | 2023-01-03 01:14:01 +0100 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2023-01-24 15:56:57 +0100 |
commit | b963113c008b4a2cef4c5f6382b50d1adeba349b (patch) | |
tree | 272e77a975173bc8962f7f867a797af3122dd688 | |
parent | fd279c9a2a7ab92d1540e9dd781a9d9bbe54b00a (diff) | |
download | mpv-b963113c008b4a2cef4c5f6382b50d1adeba349b.tar.bz2 mpv-b963113c008b4a2cef4c5f6382b50d1adeba349b.tar.xz |
vo: hwdec: fix drmGetDeviceNameFromFd2() related memory leak
This commit fixes a minor memory leak related to drmGetDeviceNameFromFd2().
This function returns a string allocated with strdup().
-rw-r--r-- | video/out/hwdec/hwdec_drmprime_overlay.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/video/out/hwdec/hwdec_drmprime_overlay.c b/video/out/hwdec/hwdec_drmprime_overlay.c index c0ccb75072..f2eaba7896 100644 --- a/video/out/hwdec/hwdec_drmprime_overlay.c +++ b/video/out/hwdec/hwdec_drmprime_overlay.c @@ -299,10 +299,14 @@ static int init(struct ra_hwdec *hw) .driver_name = hw->driver->name, .hw_imgfmt = IMGFMT_DRMPRIME, }; + + char *device = drmGetDeviceNameFromFd2(p->ctx->fd); if (!av_hwdevice_ctx_create(&p->hwctx.av_device_ref, AV_HWDEVICE_TYPE_DRM, - drmGetDeviceNameFromFd2(p->ctx->fd), NULL, 0)) { + device, NULL, 0)) { hwdec_devices_add(hw->devs, &p->hwctx); } + if (device) + free(device); return 0; |