Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: Source/core/xml/parser/XMLDocumentParser.cpp

Issue 21347002: Add missing free for the allocated memory from vasprintf(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2000 Peter Kelly (pmk@post.com) 2 * Copyright (C) 2000 Peter Kelly (pmk@post.com)
3 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
5 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) 5 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2008 Holger Hans Peter Freyther 7 * Copyright (C) 2008 Holger Hans Peter Freyther
8 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 char* formattedMessage; 1080 char* formattedMessage;
1081 if (vasprintf(&formattedMessage, message, args) == -1) 1081 if (vasprintf(&formattedMessage, message, args) == -1)
1082 return; 1082 return;
1083 #else 1083 #else
1084 char formattedMessage[1024]; 1084 char formattedMessage[1024];
1085 vsnprintf(formattedMessage, sizeof(formattedMessage) - 1, message, args); 1085 vsnprintf(formattedMessage, sizeof(formattedMessage) - 1, message, args);
1086 #endif 1086 #endif
1087 1087
1088 if (m_parserPaused) { 1088 if (m_parserPaused) {
1089 m_pendingCallbacks.append(adoptPtr(new PendingErrorCallback(type, reinte rpret_cast<const xmlChar*>(formattedMessage), lineNumber(), columnNumber()))); 1089 m_pendingCallbacks.append(adoptPtr(new PendingErrorCallback(type, reinte rpret_cast<const xmlChar*>(formattedMessage), lineNumber(), columnNumber())));
1090 #if HAVE(VASPRINTF)
1091 free(formattedMessage);
1092 #endif
1090 return; 1093 return;
1091 } 1094 }
1092 1095
1093 handleError(type, formattedMessage, textPosition()); 1096 handleError(type, formattedMessage, textPosition());
1094 1097
1095 #if HAVE(VASPRINTF) 1098 #if HAVE(VASPRINTF)
1096 free(formattedMessage); 1099 free(formattedMessage);
1097 #endif 1100 #endif
1098 } 1101 }
1099 1102
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
1598 sax.initialized = XML_SAX2_MAGIC; 1601 sax.initialized = XML_SAX2_MAGIC;
1599 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state); 1602 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state);
1600 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; 1603 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />";
1601 parseChunk(parser->context(), parseString); 1604 parseChunk(parser->context(), parseString);
1602 finishParsing(parser->context()); 1605 finishParsing(parser->context());
1603 attrsOK = state.gotAttributes; 1606 attrsOK = state.gotAttributes;
1604 return state.attributes; 1607 return state.attributes;
1605 } 1608 }
1606 1609
1607 } // namespace WebCore 1610 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698