1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-16 20:27:23 +00:00

video/drmprime: fix use-after-free

Same thing as in hwdec/drmprime.
This commit is contained in:
Philip Langdale 2022-08-09 22:14:53 -07:00
parent f87ab4d441
commit 6265cbb62a

View File

@ -30,11 +30,12 @@ static struct AVBufferRef *drm_create_standalone(struct mpv_global *global,
void *tmp = talloc_new(NULL); void *tmp = talloc_new(NULL);
struct drm_opts *drm_opts = mp_get_config_group(tmp, global, &drm_conf); struct drm_opts *drm_opts = mp_get_config_group(tmp, global, &drm_conf);
const char *opt_path = drm_opts->drm_device_path; const char *opt_path = drm_opts->drm_device_path;
talloc_free(tmp);
const char *device_path = opt_path ? opt_path : "/dev/dri/renderD128"; const char *device_path = opt_path ? opt_path : "/dev/dri/renderD128";
AVBufferRef* ref = NULL; AVBufferRef* ref = NULL;
av_hwdevice_ctx_create(&ref, AV_HWDEVICE_TYPE_DRM, device_path, NULL, 0); av_hwdevice_ctx_create(&ref, AV_HWDEVICE_TYPE_DRM, device_path, NULL, 0);
talloc_free(tmp);
return ref; return ref;
} }