frontends/va : Fix memory leaks incase of error returns
Incase of error returns missed the free calls for config and context. This patch handling in freeing them Signed-off-by: SureshGuttula <sguttula@amd.com> Reviewed-by: Vinson Lee <vlee@freedesktop.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8993>
This commit is contained in:
parent
f59e6ad5d7
commit
fc0eb6554b
|
@ -214,8 +214,10 @@ vlVaCreateConfig(VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoin
|
||||||
return VA_STATUS_ERROR_ALLOCATION_FAILED;
|
return VA_STATUS_ERROR_ALLOCATION_FAILED;
|
||||||
|
|
||||||
if (profile == VAProfileNone) {
|
if (profile == VAProfileNone) {
|
||||||
if (entrypoint != VAEntrypointVideoProc)
|
if (entrypoint != VAEntrypointVideoProc) {
|
||||||
|
FREE(config);
|
||||||
return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
|
return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
|
||||||
|
}
|
||||||
|
|
||||||
config->entrypoint = PIPE_VIDEO_ENTRYPOINT_UNKNOWN;
|
config->entrypoint = PIPE_VIDEO_ENTRYPOINT_UNKNOWN;
|
||||||
config->profile = PIPE_VIDEO_PROFILE_UNKNOWN;
|
config->profile = PIPE_VIDEO_PROFILE_UNKNOWN;
|
||||||
|
|
|
@ -251,8 +251,10 @@ vlVaCreateContext(VADriverContextP ctx, VAConfigID config_id, int picture_width,
|
||||||
config->profile, config->entrypoint,
|
config->profile, config->entrypoint,
|
||||||
PIPE_VIDEO_CAP_MAX_HEIGHT);
|
PIPE_VIDEO_CAP_MAX_HEIGHT);
|
||||||
|
|
||||||
if (picture_width > max_supported_width || picture_height > max_supported_height)
|
if (picture_width > max_supported_width || picture_height > max_supported_height) {
|
||||||
|
FREE(context);
|
||||||
return VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED;
|
return VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
context->templat.profile = config->profile;
|
context->templat.profile = config->profile;
|
||||||
context->templat.entrypoint = config->entrypoint;
|
context->templat.entrypoint = config->entrypoint;
|
||||||
|
|
Loading…
Reference in New Issue