mirror of https://github.com/mpv-player/mpv
vaapi: fix initialization error code path
"res" can be uninitialized in the error case.
This commit is contained in:
parent
7ef8d38769
commit
6565ec8b41
|
@ -108,6 +108,7 @@ static void va_get_formats(struct mp_vaapi_ctx *ctx)
|
||||||
|
|
||||||
struct mp_vaapi_ctx *va_initialize(VADisplay *display, struct mp_log *plog)
|
struct mp_vaapi_ctx *va_initialize(VADisplay *display, struct mp_log *plog)
|
||||||
{
|
{
|
||||||
|
struct mp_vaapi_ctx *res = NULL;
|
||||||
struct mp_log *log = mp_log_new(NULL, plog, "/vaapi");
|
struct mp_log *log = mp_log_new(NULL, plog, "/vaapi");
|
||||||
int major_version, minor_version;
|
int major_version, minor_version;
|
||||||
int status = vaInitialize(display, &major_version, &minor_version);
|
int status = vaInitialize(display, &major_version, &minor_version);
|
||||||
|
@ -116,7 +117,7 @@ struct mp_vaapi_ctx *va_initialize(VADisplay *display, struct mp_log *plog)
|
||||||
|
|
||||||
mp_verbose(log, "VA API version %d.%d\n", major_version, minor_version);
|
mp_verbose(log, "VA API version %d.%d\n", major_version, minor_version);
|
||||||
|
|
||||||
struct mp_vaapi_ctx *res = talloc_ptrtype(NULL, res);
|
res = talloc_ptrtype(NULL, res);
|
||||||
*res = (struct mp_vaapi_ctx) {
|
*res = (struct mp_vaapi_ctx) {
|
||||||
.log = talloc_steal(res, log),
|
.log = talloc_steal(res, log),
|
||||||
.display = display,
|
.display = display,
|
||||||
|
|
Loading…
Reference in New Issue