Bug 98384 - [WK2][GTK][EFL] standard_output returned by g_spawn_sync must be freed
Summary: [WK2][GTK][EFL] standard_output returned by g_spawn_sync must be freed
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit EFL (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sudarsana Nagineni (babu)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-04 01:06 PDT by Sudarsana Nagineni (babu)
Modified: 2012-10-05 02:19 PDT (History)
5 users (show)

See Also:


Attachments
Patch (1.53 KB, patch)
2012-10-04 01:11 PDT, Sudarsana Nagineni (babu)
no flags Details | Formatted Diff | Diff
Patch (1.50 KB, patch)
2012-10-05 01:20 PDT, Sudarsana Nagineni (babu)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sudarsana Nagineni (babu) 2012-10-04 01:06:57 PDT
standard_output returned by g_spawn_sync() leaks here if we return early after evaluating the exit status.

http://trac.webkit.org/browser/trunk/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp#L68

64	    if (!g_spawn_sync(0, argv, 0, G_SPAWN_STDERR_TO_DEV_NULL, 0, 0, &stdOut, 0, &status, 0))
65	        return false;
66	
67	    if (!WIFEXITED(status) || WEXITSTATUS(status) != EXIT_SUCCESS)
68	        return false;
Comment 1 Sudarsana Nagineni (babu) 2012-10-04 01:11:20 PDT
Created attachment 167044 [details]
Patch
Comment 2 Gyuyoung Kim 2012-10-05 00:50:12 PDT
Comment on attachment 167044 [details]
Patch

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

> Source/WebKit2/ChangeLog:3
> +        [WK2] [EFL] standard_output returned by g_spawn_sync must be freed

This is not EFL port patch. Please remove [EFL] keyword.

> Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:68
> +        free(stdOut);

Don't we need to check if stdOut is null once more?
Comment 3 Sudarsana Nagineni (babu) 2012-10-05 01:12:55 PDT
Comment on attachment 167044 [details]
Patch

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

>> Source/WebKit2/ChangeLog:3
>> +        [WK2] [EFL] standard_output returned by g_spawn_sync must be freed
> 
> This is not EFL port patch. Please remove [EFL] keyword.

This code is under GTK/EFL ifdef guards. I think make sense to add GTK too, instead of removing EFL.

>> Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:68
>> +        free(stdOut);
> 
> Don't we need to check if stdOut is null once more?

free is NULL-safe, no need to check.
Comment 4 Sudarsana Nagineni (babu) 2012-10-05 01:20:06 PDT
Created attachment 167278 [details]
Patch

Updated changelog.
Comment 5 Gyuyoung Kim 2012-10-05 01:24:52 PDT
Comment on attachment 167278 [details]
Patch

Looks make sense.
Comment 6 WebKit Review Bot 2012-10-05 02:19:25 PDT
Comment on attachment 167278 [details]
Patch

Clearing flags on attachment: 167278

Committed r130490: <http://trac.webkit.org/changeset/130490>
Comment 7 WebKit Review Bot 2012-10-05 02:19:29 PDT
All reviewed patches have been landed.  Closing bug.