After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 705388 - Deadcode scenario in relaxng.c file
Deadcode scenario in relaxng.c file
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: relaxng
git master
Other Linux
: Normal major
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2013-08-03 09:16 UTC by Gaurav
Modified: 2017-06-12 19:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
This patch fixes the dead code scenario. (400 bytes, patch)
2013-08-03 09:16 UTC, Gaurav
none Details | Review

Description Gaurav 2013-08-03 09:16:33 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.
Comment 1 Daniel Veillard 2013-09-30 03:30:49 UTC
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