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

video: fix double free in drm_atomic_create_context

Passing in an invalid DRM overlay id with the --drm-overlay option would
cause drmplane to be freed twice: once in the for-loop and once at the
error-handler label fail.

Solve by setting drmpanel to NULL after freeing it.

Also the 'return false' statement after the error handler label should
probably be 'return NULL', given that the return type of
drm_atomic_create_context returns a pointer.
This commit is contained in:
Anton Kindestam 2017-11-06 00:30:48 +01:00 committed by Jan Ekström
parent 9bbf8a6dfa
commit 5129d777a6

View File

@ -203,6 +203,7 @@ struct drm_atomic_context *drm_atomic_create_context(struct mp_log *log, int fd,
}
}
drmModeFreePlane(drmplane);
drmplane = NULL;
}
if (!ctx->primary_plane) {
@ -232,7 +233,7 @@ fail:
drmModeFreePlane(drmplane);
if (plane)
drm_object_free(plane);
return false;
return NULL;
}
void drm_atomic_destroy_context(struct drm_atomic_context *ctx)