Bug 124401

Summary: [EFL] Leak in ewk_frame_certificate_status_get()
Product: WebKit Reporter: Alberto Garcia <berto>
Component: WebKit EFLAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, cgarcia, commit-queue, eflews.bot, gyuyoung.kim, lucas.de.marchi, rakuco
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
eflews.bot: commit-queue-
Patch
none
Patch cgarcia: review+

Description Alberto Garcia 2013-11-15 02:17:52 PST
I just stumbled upon this piece of code in ewk_frame.cpp:

   SoupMessage* soupMessage = documentLoader->request().toSoupMessage();

That object is not being freed.
Comment 1 Alberto Garcia 2013-11-15 02:20:03 PST
Created attachment 217030 [details]
Patch

Here's the patch, it should work fine but note that I don't have a working WebKitEFL environment here to test it.
Comment 2 EFL EWS Bot 2013-11-15 02:23:07 PST
Comment on attachment 217030 [details]
Patch

Attachment 217030 [details] did not pass efl-ews (efl):
Output: http://webkit-queues.appspot.com/results/23968033
Comment 3 Alberto Garcia 2013-11-15 02:46:27 PST
Created attachment 217033 [details]
Patch

Right, here's a new version.
Comment 4 Carlos Garcia Campos 2013-11-15 04:51:40 PST
Comment on attachment 217033 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=217033&action=review

> Source/WebKit/efl/ewk/ewk_frame.cpp:1705
> -    SoupMessage* soupMessage = documentLoader->request().toSoupMessage();
> +    GRefPtr<SoupMessage> soupMessage(adoptGRef(documentLoader->request().toSoupMessage()));
>  
> -    if (soupMessage && (soup_message_get_flags(soupMessage) & SOUP_MESSAGE_CERTIFICATE_TRUSTED))
> +    if (soupMessage && (soup_message_get_flags(soupMessage.get()) & SOUP_MESSAGE_CERTIFICATE_TRUSTED))

I think you could even avoid to create the soup message object by simply using 

if (documentLoader->request().soupMessageFlags() & SOUP_MESSAGE_CERTIFICATE_TRUSTED)
Comment 5 Alberto Garcia 2013-11-15 05:17:35 PST
Created attachment 217043 [details]
Patch

(In reply to comment #4)
> I think you could even avoid to create the soup message object by simply using
>
> if (documentLoader->request().soupMessageFlags() & SOUP_MESSAGE_CERTIFICATE_TRUSTED)

Good point, here's the new patch.
Comment 6 Chris Dumez 2013-11-15 05:19:46 PST
Comment on attachment 217043 [details]
Patch

LGTM
Comment 7 Alberto Garcia 2013-11-15 06:05:55 PST
Committed r159334: <http://trac.webkit.org/changeset/159334>