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().
This commit is contained in:
repojohnray
2023-01-02 16:48:24 -08:00
committed by Philip Langdale
parent 2e9c43f931
commit fee6847aa7
+5 -1
View File
@@ -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;