GNOME Bugzilla – Bug 705388
Deadcode scenario in relaxng.c file
Last modified: 2017-06-12 19:06:07 UTC
Created attachment 250754 [details] [review] This patch fixes the dead code scenario. In file: https://git.gnome.org/browse/libxml2/tree/relaxng.c Function: xmlRelaxNGSchemaTypeCompare Line: 2587 to 2595 if (comp1 == NULL) { ret = xmlSchemaValPredefTypeNode(typ, value1, &res1, ctxt1); if (ret != 0) return (-1); if (res1 == NULL) return (-1); } else { res1 = (xmlSchemaValPtr) comp1; } Here, res1 is NULL checked if (comp1 == NULL) and assigned comp1 in else condition. It means after this if-else condition value of res1 cannot be NULL. But, at line no: 2602 res1 is again checked against NULL which is of no use and hence removed. Attached patch is fix for this.
okay there was another test against NULL earlier not detected by your tool, I commited the resulting fix: https://git.gnome.org/browse/libxml2/commit/?id=7d4e259fbfa24ef2c07a66f4b3d7ad311e68de1b thanks ! Daniel