Skip to content

Add some null checks

Rosen Penev requested to merge mangix/libxml2:null into master

Found with MSVC's /analyzer

Signed-off-by: Rosen Penev rosenp@gmail.com

there are more. not sure how to fix them.

D:\a\libxml2\libxml2\hash.c(549) : warning C6011: Dereferencing NULL pointer 'entry'. : Lines: 428, 429, 430, 431, 432, 434, 440, 441, 443, 456, 493, 517, 518, 520, 522, 530, 533, 542, 549
D:\a\libxml2\libxml2\hash.c(564) : warning C28182: Dereferencing NULL pointer. 'hash->table' contains the same NULL value as 'cur' did. See line 550 for an earlier location where this can occur: Lines: 428, 429, 430, 431, 432, 434, 440, 441, 443, 456, 493, 517, 518, 520, 522, 530, 533, 542, 549, 550, 551, 554, 555, 556, 557, 559, 564
D:\a\libxml2\libxml2\SAX2.c(342) : warning C6011: Dereferencing NULL pointer 'ctxt->input'. : Lines: 277, 278, 280, 286, 287, 288, 289, 290, 291, 292, 293, 298, 299, 301, 305, 314, 315, 316, 317, 318, 319, 321, 323, 333, 334, 335, 336, 338, 340, 341, 342
D:\a\libxml2\libxml2\tree.c(4404) : warning C28182: Dereferencing NULL pointer. 'q' contains the same NULL value as 'doc->intSubset' did. : Lines: 4375, 4376, 4377, 4378, 4380, 4381, 4384, 4385, 4389, 4390, 4391, 4393, 4394, 4395, 4423, 4424, 4425, 4426, 4433, 4380, 4381, 4384, 4385, 4389, 4401, 4402, 4404
D:\a\libxml2\libxml2\tree.c(4443) : warning C6011: Dereferencing NULL pointer 'doc->intSubset'. See line 4404 for an earlier location where this can occur: Lines: 4375, 4376, 4377, 4378, 4380, 4381, 4384, 4385, 4389, 4390, 4391, 4393, 4394, 4395, 4423, 4424, 4425, 4426, 4433, 4380, 4381, 4384, 4385, 4389, 4401, 4402, 4404, 4408, 4410, 4414, 4416, 4417, 4418, 4423, 4438, 4439, 4440, 4441, 4442, 4443
D:\a\libxml2\libxml2\parser.c(7938) : warning C6011: Dereferencing NULL pointer 'ctxt->input'. : Lines: 7889, 7890, 7891, 7892, 7893, 7894, 7895, 7896, 7900, 7907, 7909, 7912, 7913, 7914, 7915, 7916, 7918, 7919, 7920, 7921, 7922, 7923, 7929, 7931, 7933, 7938
D:\a\libxml2\libxml2\dict.c(797) : warning C6011: Dereferencing NULL pointer 'entry'. : Lines: 700, 701, 702, 703, 704, 706, 709, 711, 717, 718, 720, 723, 729, 731, 734, 750, 756, 787, 790, 791, 797
D:\a\libxml2\libxml2\dict.c(812) : warning C28182: Dereferencing NULL pointer. 'dict->table' contains the same NULL value as 'cur' did. See line 798 for an earlier location where this can occur: Lines: 700, 701, 702, 703, 704, 706, 709, 711, 717, 718, 720, 723, 729, 731, 734, 750, 756, 787, 790, 791, 797, 798, 799, 802, 803, 804, 805, 807, 812
D:\a\libxml2\libxml2\catalog.c(1823) : warning C28182: Dereferencing NULL pointer. 'catal' contains the same NULL value as 'cur' did. See line 1619 for an earlier location where this can occur: Lines: 1611, 1612, 1613, 1614, 1619, 1625, 1630, 1726, 1727, 1728, 1729, 1754, 1802, 1823
D:\a\libxml2\libxml2\xmlIO.c(383) : warning C6011: Dereferencing NULL pointer 'wString'. : Lines: 363, 364, 366, 367, 370, 371, 372, 383
D:\a\libxml2\libxml2\xmlsave.c(1061) : warning C6011: Dereferencing NULL pointer 'doc'. : Lines: 1033, 1034, 1035, 1036, 1037, 1038, 1040, 1042, 1043, 1052, 1054, 1056, 1057, 1059, 1060, 1061
D:\a\libxml2\libxml2\xmlregexp.c(3602) : warning C6011: Dereferencing NULL pointer 'valStr'. See line 3581 for an earlier location where this can occur: Lines: 3574, 3575, 3576, 3581, 3583, 3584, 3586, 3587, 3588, 3590, 3592, 3602
D:\a\libxml2\libxml2\xmlregexp.c(3738) : warning C6011: Dereferencing NULL pointer 'exec->state'. : Lines: 3692, 3693, 3694, 3695, 3696, 3698, 3700, 3702, 3705, 3708, 3718, 3724, 3734, 3737, 3738, 3952, 3953, 3958, 3972, 3973, 3974, 3724, 3734, 3737, 3738
D:\a\libxml2\libxml2\xmlregexp.c(4207) : warning C6011: Dereferencing NULL pointer 'exec->comp'. : Lines: 4082, 4083, 4086, 4089, 4090, 4091, 4092, 4130, 4131, 4132, 4133, 4135, 4142, 4146, 4147, 4149, 4150, 4152, 4153, 4155, 4156, 4158, 4160, 4162, 4180, 4151, 4150, 4191, 4192, 4194, 4195, 4197, 4198, 4200, 4202, 4204, 4207
D:\a\libxml2\libxml2\relaxng.c(5694) : warning C28182: Dereferencing NULL pointer. 'define' contains the same NULL value as 'cur' did. See line 5652 for an earlier location where this can occur: Lines: 5645, 5646, 5647, 5648, 5649, 5650, 5652, 5654, 5655, 5692, 5693, 5694
D:\a\libxml2\libxml2\relaxng.c(9256) : warning C6011: Dereferencing NULL pointer 'group'. : Lines: 9098, 9099, 9100, 9102, 9103, 9104, 9105, 9106, 9108, 9109, 9110, 9118, 9119, 9151, 9152, 9156, 9157, 9158, 9162, 9168, 9169, 9170, 9171, 9172, 9173, 9210, 9211, 9212, 9210, 9221, 9237, 9242, 9243, 9244, 9245, 9246, 9250, 9251, 9255, 9256
D:\a\libxml2\libxml2\relaxng.c(9361) : warning C6011: Dereferencing NULL pointer 'ctxt->state'. See line 9168 for an earlier location where this can occur: Lines: 9098, 9099, 9100, 9102, 9103, 9104, 9105, 9106, 9108, 9109, 9110, 9118, 9119, 9151, 9152, 9156, 9157, 9158, 9162, 9168, 9169, 9170, 9171, 9237, 9242, 9243, 9244, 9358, 9360, 9361
D:\a\libxml2\libxml2\relaxng.c(9691) : warning C6011: Dereferencing NULL pointer 'ctxt->state'. : Lines: 9662, 9663, 9664, 9666, 9671, 9674, 9676, 9677, 9684, 9685, 9691
D:\a\libxml2\libxml2\xinclude.c(770) : warning C6011: Dereferencing NULL pointer 'insertParent'. : Lines: 674, 675, 676, 677, 678, 679, 681, 682, 683, 689, 690, 691, 693, 698, 729, 730, 735, 736, 737, 740, 743, 745, 748, 752, 760, 763, 764, 766, 767, 769, 770
D:\a\libxml2\libxml2\runsuite.c(322) : warning C6011: Dereferencing NULL pointer 'buf'. : Lines: 292, 293, 294, 295, 296, 298, 299, 303, 304, 310, 311, 315, 316, 317, 318, 320, 321, 322
D:\a\libxml2\libxml2\runsuite.c(368) : warning C6011: Dereferencing NULL pointer 'buf'. : Lines: 350, 351, 352, 354, 355, 356, 357, 359, 360, 362, 363, 364, 365, 366, 367, 368
D:\a\libxml2\libxml2\xmllint.c(279) : warning C6011: Dereferencing NULL pointer 'defaultEntityLoader'. : Lines: 232, 233, 234, 236, 237, 238, 240, 248, 255, 272, 273, 275, 276, 277, 278, 279
D:\a\libxml2\libxml2\xpath.c(501) : warning C28182: Dereferencing NULL pointer. 'node1' contains the same NULL value as 'cur->parent' did. See line 450 for an earlier location where this can occur: Lines: 261, 262, 263, 264, 265, 267, 270, 276, 293, 294, 295, 296, 297, 347, 350, 351, 352, 353, 354, 392, 393, 429, 437, 453, 464, 466, 468, 473, 478, 479, 487, 493, 497, 501
D:\a\libxml2\libxml2\xpath.c(501) : warning C28182: Dereferencing NULL pointer. 'node2' contains the same NULL value as 'cur->parent' did. See line 466 for an earlier location where this can occur: Lines: 261, 262, 263, 264, 265, 267, 270, 276, 293, 294, 295, 296, 297, 347, 350, 351, 352, 353, 354, 392, 393, 429, 437, 453, 464, 466, 468, 473, 478, 479, 487, 493, 497, 501
D:\a\libxml2\libxml2\xpath.c(2604) : warning C28182: Dereferencing NULL pointer. 'node1' contains the same NULL value as 'cur->parent' did. See line 2547 for an earlier location where this can occur: Lines: 2507, 2508, 2509, 2510, 2512, 2517, 2519, 2520, 2521, 2522, 2524, 2525, 2526, 2527, 2529, 2547, 2550, 2552, 2561, 2576, 2581, 2582, 2590, 2596, 2600, 2604
D:\a\libxml2\libxml2\xpath.c(2604) : warning C28182: Dereferencing NULL pointer. 'node2' contains the same NULL value as 'cur->parent' did. See line 2548 for an earlier location where this can occur: Lines: 2507, 2508, 2509, 2510, 2512, 2517, 2519, 2520, 2521, 2522, 2524, 2525, 2526, 2527, 2529, 2547, 2550, 2552, 2561, 2576, 2581, 2582, 2590, 2596, 2600, 2604
D:\a\libxml2\libxml2\xmlschemas.c(13816) : warning C6011: Dereferencing NULL pointer 'curWild->negNsSet'. : Lines: 13753, 13760, 13796, 13807, 13809, 13811, 13816
D:\a\libxml2\libxml2\xmlschemas.c(17696) : warning C28182: Dereferencing NULL pointer. 'bfacet' contains the same NULL value as 'flength' did. See line 17299 for an earlier location where this can occur: Lines: 17227, 17228, 17229, 17230, 17231, 17232, 17233, 17234, 17235, 17236, 17237, 17238, 17264, 17267, 17268, 17269, 17272, 17273, 17274, 17275, 17276, 17272, 17297, 17298, 17299, 17300, 17301, 17297, 17325, 17333, 17339, 17346, 17361, 17375, 17392, 17393, 17394, 17416, 17471, 17526, 17581, 17634, 17649, 17667, 17668, 17669, 17670, 17671, 17690, 17691, 17696
D:\a\libxml2\libxml2\xmlschemas.c(17707) : warning C28182: Dereferencing NULL pointer. 'facet' contains the same NULL value as 'flength' did. See line 17274 for an earlier location where this can occur: Lines: 17227, 17228, 17229, 17230, 17231, 17232, 17233, 17234, 17235, 17236, 17237, 17238, 17264, 17267, 17268, 17269, 17272, 17273, 17274, 17275, 17276, 17272, 17297, 17298, 17299, 17300, 17301, 17297, 17325, 17333, 17339, 17346, 17361, 17375, 17392, 17393, 17394, 17416, 17471, 17526, 17581, 17634, 17649, 17667, 17668, 17669, 17670, 17671, 17690, 17691, 17696, 17702, 17705, 17706, 17707
D:\a\libxml2\libxml2\xmlschemas.c(18484) : warning C6011: Dereferencing NULL pointer 'particle->children'. : Lines: 18094, 18095, 18097, 18099, 18100, 18108, 18110, 18120, 18121, 18125, 18270, 18271, 18283, 18334, 18339, 18351, 18368, 18378, 18385, 18405, 18424, 18484
D:\a\libxml2\libxml2\xmlschemas.c(18792) : warning C6011: Dereferencing NULL pointer 'pctxt->vctxt'. : Lines: 18775, 18776, 18781, 18782, 18788, 18789, 18792
D:\a\libxml2\libxml2\xmlschemas.c(19769) : warning C28182: Dereferencing NULL pointer. 'elemDecl->subtypes' contains the same NULL value as 'type' did. : Lines: 19705, 19710, 19711, 19712, 19718, 19720, 19721, 19725, 19727, 19728, 19729, 19731, 19733, 19753, 19769
D:\a\libxml2\libxml2\xmlschemas.c(27974) : warning C28182: Dereferencing NULL pointer. 'pctxt' contains the same NULL value as 'vctxt->pctxt' did. : Lines: 27947, 27948, 27949, 27950, 27951, 27955, 27960, 27961, 27963, 27970, 27973, 27974
D:\a\libxml2\libxml2\testrecurse.c(125) : warning C28182: Dereferencing NULL pointer. 'ret->gl_pathv' contains the same NULL value as 'realloc()`113' did. See line 120 for an earlier location where this can occur: Lines: 71, 72, 73, 74, 75, 76, 78, 80, 81, 88, 89, 92, 93, 95, 96, 98, 99, 100, 104, 105, 106, 108, 109, 110, 112, 113, 114, 116, 117, 119, 120, 121, 123, 109, 110, 112, 113, 114, 125
D:\a\libxml2\libxml2\runtest.c(181) : warning C28182: Dereferencing NULL pointer. 'ret->gl_pathv' contains the same NULL value as 'realloc()`169' did. See line 176 for an earlier location where this can occur: Lines: 127, 128, 129, 130, 131, 132, 134, 136, 137, 144, 145, 148, 149, 151, 152, 154, 155, 156, 160, 161, 162, 164, 165, 166, 168, 169, 170, 172, 173, 175, 176, 177, 179, 165, 166, 168, 169, 170, 181
Edited by Rosen Penev

Merge request reports