Mesa (master): frontends/va : Fix memory leaks incase of error returns
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Feb 16 19:19:45 UTC 2021
Module: Mesa
Branch: master
Commit: fc0eb6554bc7a40659dcf12e9619481d57da2013
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fc0eb6554bc7a40659dcf12e9619481d57da2013
Author: SureshGuttula <sguttula at amd.com>
Date: Thu Feb 11 23:24:17 2021 +0530
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 at amd.com>
Reviewed-by: Vinson Lee <vlee at freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8993>
---
src/gallium/frontends/va/config.c | 4 +++-
src/gallium/frontends/va/context.c | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/gallium/frontends/va/config.c b/src/gallium/frontends/va/config.c
index e658867f6e0..2b37d8cb8d3 100644
--- a/src/gallium/frontends/va/config.c
+++ b/src/gallium/frontends/va/config.c
@@ -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;
diff --git a/src/gallium/frontends/va/context.c b/src/gallium/frontends/va/context.c
index 556e0cb74e7..53077ee45c7 100644
--- a/src/gallium/frontends/va/context.c
+++ b/src/gallium/frontends/va/context.c
@@ -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;
More information about the mesa-commit
mailing list