[PATCH] d3dcompiler: Fix a leak on error path (Coverity).
Sven Baars
sbaars at codeweavers.com
Sun Oct 4 15:35:32 CDT 2020
Signed-off-by: Sven Baars <sbaars at codeweavers.com>
---
dlls/d3dcompiler_43/utils.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/dlls/d3dcompiler_43/utils.c b/dlls/d3dcompiler_43/utils.c
index df39716b495..971a5bef9c7 100644
--- a/dlls/d3dcompiler_43/utils.c
+++ b/dlls/d3dcompiler_43/utils.c
@@ -1450,19 +1450,22 @@ struct hlsl_ir_node *add_assignment(struct list *instrs, struct hlsl_ir_node *lh
struct hlsl_type *lhs_type;
DWORD writemask = 0;
+ if (!assign)
+ {
+ ERR("Out of memory\n");
+ return NULL;
+ }
+
lhs_type = lhs->data_type;
if (lhs_type->type <= HLSL_CLASS_LAST_NUMERIC)
{
writemask = (1 << lhs_type->dimx) - 1;
if (!(rhs = add_implicit_conversion(instrs, rhs, lhs_type, &rhs->loc)))
+ {
+ d3dcompiler_free(assign);
return NULL;
- }
-
- if (!assign)
- {
- ERR("Out of memory\n");
- return NULL;
+ }
}
while (lhs->type != HLSL_IR_LOAD)
--
2.25.1
More information about the wine-devel
mailing list