[PATCH] CID494: check for NULL return

Marcus Meissner meissner at suse.de
Thu Feb 1 09:25:06 CST 2007


Hi,

spotted by Coverity.

get_attrp() could return NULL (perhaps if we forgot the UUID)
and we could crash later on.

So just check for it.

Ciao, Marcus
---
 tools/widl/server.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/tools/widl/server.c b/tools/widl/server.c
index 75b9647..f64253d 100644
--- a/tools/widl/server.c
+++ b/tools/widl/server.c
@@ -359,6 +359,11 @@ static void write_serverinterfacedecl(ty
     unsigned long ver = get_attrv(iface->attrs, ATTR_VERSION);
     UUID *uuid = get_attrp(iface->attrs, ATTR_UUID);
 
+    if (!uuid) {
+    	error("Could not get UUID attribute!\n");
+	return;
+    }
+
     print_server("extern RPC_DISPATCH_TABLE %s_v%d_%d_DispatchTable;\n", iface->name, LOWORD(ver), HIWORD(ver));
     fprintf(server, "\n");
     print_server("static const RPC_SERVER_INTERFACE %s___RpcServerInterface =\n", iface->name );
-- 
1.4.3.4



More information about the wine-patches mailing list