Title: [211677] trunk/Source/WebCore
- Revision
- 211677
- Author
- commit-qu...@webkit.org
- Date
- 2017-02-04 22:23:41 -0800 (Sat, 04 Feb 2017)
Log Message
Static Analyzer: WebCoreNSURLExtras.mm: Potential leak of memory pointed to by 'allBytesBuffer'
https://bugs.webkit.org/show_bug.cgi?id=167849
Patch by Joseph Pecoraro <pecor...@apple.com> on 2017-02-04
Reviewed by Sam Weinig.
Source/WebCore/platform/mac/WebCoreNSURLExtras.mm:883:20: warning: Potential leak of memory pointed to by 'allBytesBuffer'
return nil;
^~~
* platform/mac/WebCoreNSURLExtras.mm:
(WebCore::dataForURLComponentType):
Free the potentially malloc'd buffer before the early return.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (211676 => 211677)
--- trunk/Source/WebCore/ChangeLog 2017-02-05 02:20:33 UTC (rev 211676)
+++ trunk/Source/WebCore/ChangeLog 2017-02-05 06:23:41 UTC (rev 211677)
@@ -1,3 +1,18 @@
+2017-02-04 Joseph Pecoraro <pecor...@apple.com>
+
+ Static Analyzer: WebCoreNSURLExtras.mm: Potential leak of memory pointed to by 'allBytesBuffer'
+ https://bugs.webkit.org/show_bug.cgi?id=167849
+
+ Reviewed by Sam Weinig.
+
+ Source/WebCore/platform/mac/WebCoreNSURLExtras.mm:883:20: warning: Potential leak of memory pointed to by 'allBytesBuffer'
+ return nil;
+ ^~~
+
+ * platform/mac/WebCoreNSURLExtras.mm:
+ (WebCore::dataForURLComponentType):
+ Free the potentially malloc'd buffer before the early return.
+
2017-02-04 Chris Dumez <cdu...@apple.com>
Unreviewed, fix mistake in comment added in r211569.
Modified: trunk/Source/WebCore/platform/mac/WebCoreNSURLExtras.mm (211676 => 211677)
--- trunk/Source/WebCore/platform/mac/WebCoreNSURLExtras.mm 2017-02-05 02:20:33 UTC (rev 211676)
+++ trunk/Source/WebCore/platform/mac/WebCoreNSURLExtras.mm 2017-02-05 06:23:41 UTC (rev 211677)
@@ -879,8 +879,11 @@
CFRange range;
if (componentType != completeURL) {
range = CFURLGetByteRangeForComponent((CFURLRef)URL, componentType, NULL);
- if (range.location == kCFNotFound)
+ if (range.location == kCFNotFound) {
+ if (staticAllBytesBuffer != allBytesBuffer)
+ free(allBytesBuffer);
return nil;
+ }
} else {
range.location = 0;
range.length = bytesFilled;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes