Bug 65789

Summary: Leak in CFNetwork Loader RetainPtr<> should Adopt a Copy allocation
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: aroben, bweinstein, joepeck, psolanki, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
[PATCH] Proposed Fix
darin: review+, joepeck: commit-queue-
[PATCH] Fix Build Issue With Previous Patch none

Joseph Pecoraro
Reported 2011-08-05 13:57:10 PDT
Both of these: if (RetainPtr<CFDataRef> bodyData = CFURLRequestCopyHTTPRequestBody(request)) return FormData::create(CFDataGetBytePtr(bodyData.get()), CFDataGetLength(bodyData.get())); if (RetainPtr<CFArrayRef> bodyParts = wkCFURLRequestCopyHTTPRequestBodyParts(request)) { RefPtr<FormData> formData = FormData::create(); Cause leaks because RetainPtr::operation= will CFRetain() but FooCopyBar() already returns a +1 allocation. We should adopt the reference with AdoptCF.
Attachments
[PATCH] Proposed Fix (1.73 KB, patch)
2011-08-05 14:00 PDT, Joseph Pecoraro
darin: review+
joepeck: commit-queue-
[PATCH] Fix Build Issue With Previous Patch (1.76 KB, patch)
2011-08-05 14:48 PDT, Joseph Pecoraro
no flags
Joseph Pecoraro
Comment 1 2011-08-05 14:00:18 PDT
Created attachment 103104 [details] [PATCH] Proposed Fix
Joseph Pecoraro
Comment 2 2011-08-05 14:30:07 PDT
Comment on attachment 103104 [details] [PATCH] Proposed Fix cq- based on the bot failing to build on Windows.
Joseph Pecoraro
Comment 3 2011-08-05 14:34:09 PDT
Windows build bot says: http://queues.webkit.org/results/9323095 3>####### COMPILING 2 FILES USING AT MOST 8 PARALLEL INSTANCES OF cl.exe ########### 3>FormDataStreamCFNet.cpp 3>..\platform\network\cf\FormDataStreamCFNet.cpp(94) : error C2061: syntax error : identifier 'AdoptCF' 3>..\platform\network\cf\FormDataStreamCFNet.cpp(94) : error C2059: syntax error : ')' 3>..\platform\network\cf\FormDataStreamCFNet.cpp(95) : error C2143: syntax error : missing ';' before 'return' 3>..\platform\network\cf\FormDataStreamCFNet.cpp(95) : error C2065: 'bodyData' : undeclared identifier 3>..\platform\network\cf\FormDataStreamCFNet.cpp(95) : error C2228: left of '.get' must have class/struct/union 3> type is ''unknown-type'' 3>..\platform\network\cf\FormDataStreamCFNet.cpp(95) : error C2228: left of '.get' must have class/struct/union 3> type is ''unknown-type'' This built fine for me locally. Maybe the Window's compiler doesn't like the shorthand constructor syntax inside of an if statement? I could move the assignments outside of the if statements if needed. Adding some windows developers.
Joseph Pecoraro
Comment 4 2011-08-05 14:34:33 PDT
s/if statement/if condition/
Joseph Pecoraro
Comment 5 2011-08-05 14:48:44 PDT
Created attachment 103117 [details] [PATCH] Fix Build Issue With Previous Patch I forgot that by default PLATFORM(MAC) doesn't take this path by default. So my local build was a false positive. I've now tested building this change correctly.
David Kilzer (:ddkilzer)
Comment 6 2011-08-05 16:24:46 PDT
Comment on attachment 103117 [details] [PATCH] Fix Build Issue With Previous Patch r=me
WebKit Review Bot
Comment 7 2011-08-05 17:25:05 PDT
Comment on attachment 103117 [details] [PATCH] Fix Build Issue With Previous Patch Clearing flags on attachment: 103117 Committed r92530: <http://trac.webkit.org/changeset/92530>
WebKit Review Bot
Comment 8 2011-08-05 17:25:09 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.