]> granicus.if.org Git - libexpat/commitdiff
xmlparse.c: Resolve superfluous internal malloc/realloc switch (#6)
authorSebastian Pipping <sebastian@pipping.org>
Mon, 28 Aug 2017 22:39:58 +0000 (00:39 +0200)
committerSebastian Pipping <sebastian@pipping.org>
Mon, 28 Aug 2017 22:39:58 +0000 (00:39 +0200)
expat/Changes
expat/lib/xmlparse.c

index 789ca9ba5e4356daaa4c434dcecd51465cdddad1..345d2213d6342ec314d01a46e8fbc53de61a3ecb 100644 (file)
@@ -20,6 +20,7 @@ Release 2.2.5 ???????????????????
             #129  examples: Fix compilation for XML_UNICODE_WCHAR_T
             #130  benchmark: Fix compilation for XML_UNICODE_WCHAR_T
               #9  Address two Clang Static Analyzer false positives
+              #6  Resolve superfluous internal malloc/realloc switch
 
         Special thanks to:
             Benbuck Nason
index 7e9ddff58c4a50535bb6dce8b6364753d5c98e02..1af1e8dbfd9fc737d813e467f060811dd548fccf 100644 (file)
@@ -2012,9 +2012,7 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
         char *temp = NULL;
         const int bytesToAllocate = (int)((unsigned)len * 2U);
         if (bytesToAllocate > 0) {
-          temp = (buffer == NULL
-                ? (char *)MALLOC(bytesToAllocate)
-                : (char *)REALLOC(buffer, bytesToAllocate));
+          temp = (char *)REALLOC(buffer, bytesToAllocate);
         }
         if (temp == NULL) {
           errorCode = XML_ERROR_NO_MEMORY;