[1/2] widl: Check for NULL in set_tfswrite
Dan Hipschman
dsh at linux.ucla.edu
Thu Jun 7 19:43:06 CDT 2007
This fixes a crash caused by dereferencing a NULL pointer when running:
widl -c oaidl.idl
The problem was that unions are allowed to have nameless/typeless default
fields, and this part of the code was not checking for those.
---
tools/widl/typegen.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index 2327e21..7c0921e 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -1457,7 +1457,7 @@ static void set_tfswrite(type_t *type, int val)
if (type->kind == TKIND_ALIAS)
type = type->orig;
- else if (is_ptr(type))
+ else if (is_ptr(type) || is_array(type))
type = type->ref;
else
{
@@ -1465,7 +1465,8 @@ static void set_tfswrite(type_t *type, int val)
{
var_t *v;
LIST_FOR_EACH_ENTRY( v, type->fields, var_t, entry )
- set_tfswrite(v->type, val);
+ if (v->type)
+ set_tfswrite(v->type, val);
}
return;
More information about the wine-patches
mailing list