summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrepojohnray <8113421+repojohnray@users.noreply.github.com>2023-01-03 01:14:01 +0100
committersfan5 <sfan5@live.de>2023-01-24 15:56:57 +0100
commitb963113c008b4a2cef4c5f6382b50d1adeba349b (patch)
tree272e77a975173bc8962f7f867a797af3122dd688
parentfd279c9a2a7ab92d1540e9dd781a9d9bbe54b00a (diff)
downloadmpv-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.c6
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;