[PATCH 1/4] Check for null pointers before strcmp. (LLVM/Clang)

Juan Lang juan.lang at gmail.com
Fri Jun 10 16:19:43 CDT 2011


Hi Lauri,
     ok(pdst != NULL, "inet_ntoa failed %s\n", dst);
-    ok(!strcmp(pdst, addr0_Str),"Address %s != %s\n", pdst, addr0_Str);
+    ok(pdst && !strcmp(pdst, addr0_Str),"Address %s != %s\n", pdst, addr0_Str);

This change doesn't accomplish anything.  In the first place, the
previous ok which you did not change already ensures pdst is not NULL.
 While it's true that this ok could fail, leading to a following crash
in the tests, the fact that the tests pass indicates this isn't
happening.  Second, the ok output message also dereferences pdst by
printing it, so in the case that it is NULL, you haven't fixed
anything.

Really, I suggest you just ignore this warning, it's not worth the
extra baggage.
--Juan



More information about the wine-devel mailing list