summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorrepojohnray <8113421+repojohnray@users.noreply.github.com>2023-01-03 01:14:01 +0100
committerPhilip Langdale <github.philipl@overt.org>2023-01-02 16:48:24 -0800
commitfee6847aa7dfea721ef217824100eebfd0d7aa26 (patch)
tree976f17392927c7e7e44e8c91f383b3a8b7a18dc2 /video
parent2e9c43f9318d416fc26f20aa55841ee7fcfeee4a (diff)
downloadmpv-fee6847aa7dfea721ef217824100eebfd0d7aa26.tar.bz2
mpv-fee6847aa7dfea721ef217824100eebfd0d7aa26.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().
Diffstat (limited to 'video')
-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 bda6c6bdc1..7e3c0b276d 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;