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:
SureshGuttula 2021-02-11 23:06:17 +05:30 committed by Marge Bot
parent f59e6ad5d7
commit fc0eb6554b
2 changed files with 6 additions and 2 deletions

View File

@ -214,8 +214,10 @@ vlVaCreateConfig(VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoin
return VA_STATUS_ERROR_ALLOCATION_FAILED;
if (profile == VAProfileNone) {
if (entrypoint != VAEntrypointVideoProc)
if (entrypoint != VAEntrypointVideoProc) {
FREE(config);
return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
}
config->entrypoint = PIPE_VIDEO_ENTRYPOINT_UNKNOWN;
config->profile = PIPE_VIDEO_PROFILE_UNKNOWN;

View File

@ -251,8 +251,10 @@ vlVaCreateContext(VADriverContextP ctx, VAConfigID config_id, int picture_width,
config->profile, config->entrypoint,
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;
}
}
context->templat.profile = config->profile;
context->templat.entrypoint = config->entrypoint;