summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Langdale <philipl@overt.org>2022-08-09 22:14:53 -0700
committerPhilip Langdale <philipl@overt.org>2022-08-09 22:19:45 -0700
commit6265cbb62a9169429bbc1b20f41c8dd50f6b8147 (patch)
treeead464eb02918ea858bc2684c465e36c41b2ce56
parentf87ab4d441fa233e5be7b1a6a4dda8db2bd3e02f (diff)
downloadmpv-6265cbb62a9169429bbc1b20f41c8dd50f6b8147.tar.bz2
mpv-6265cbb62a9169429bbc1b20f41c8dd50f6b8147.tar.xz
video/drmprime: fix use-after-free
Same thing as in hwdec/drmprime.
-rw-r--r--video/drmprime.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/video/drmprime.c b/video/drmprime.c
index 92bf1c9aa3..b8fda3b726 100644
--- a/video/drmprime.c
+++ b/video/drmprime.c
@@ -30,11 +30,12 @@ static struct AVBufferRef *drm_create_standalone(struct mpv_global *global,
void *tmp = talloc_new(NULL);
struct drm_opts *drm_opts = mp_get_config_group(tmp, global, &drm_conf);
const char *opt_path = drm_opts->drm_device_path;
- talloc_free(tmp);
const char *device_path = opt_path ? opt_path : "/dev/dri/renderD128";
AVBufferRef* ref = NULL;
av_hwdevice_ctx_create(&ref, AV_HWDEVICE_TYPE_DRM, device_path, NULL, 0);
+
+ talloc_free(tmp);
return ref;
}