[Webkit-unassigned] [Bug 55455] [EFL] HTML saving feature

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon May 23 02:06:43 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=55455





--- Comment #23 from Grzegorz <g.czajkowski at samsung.com>  2011-05-23 02:06:43 PST ---
(From update of attachment 93880)
View in context: https://bugs.webkit.org/attachment.cgi?id=93880&action=review

>>> Source/WebKit/efl/ewk/ewk_frame.cpp:2040
>>> +    // Look for <html> tag. If it exists, the node contatins all document's source.
>> 
>> What will happen if it is a XHTML page? WAP page?
> 
> This feature is limited to support HTML documents at the moment. You can see a checking above (line 2034). I notice about this in ChangeLog too. I have plans to extend this feature for others documents.

This feature is limited to support HTML documents at the moment. You can see a checking above (line 2034). I notice about this in ChangeLog too. I have plans to extend this feature for others documents.

>>> Source/WebKit/efl/ewk/ewk_frame.cpp:2062
>>> +    *frame_source = static_cast<char*>(malloc(sizeof(char) * source_length + sizeof(char)));
>> 
>> sizeof(char) = 1 :)
> 
> Did you mean:
> malloc(source_length + sizeof(char)) ? :)

Did you mean:
malloc(source_length + sizeof(char)) ? :)

>>> Source/WebKit/efl/ewk/ewk_frame.cpp:2116
>>> +        if (eina_error_get()) {
>> 
>> eina_error_get() does not catches the possible failure in allocation due to strdup() returning NULL, only eina-related stuff, like allocating a new node for the list.
>> 
>> The error handling is fine, however; change just the error detection.
> 
> Right. I will fix this.

What do you say of using goto? We have to free the all Eina_List if we can not allocate memory (while strdup and allocating a new node for the list. My suggestion is:

    char* duplicate = strdup(img_location.utf8().data());
    if (!duplicate)
        goto error;
    img_location_list = eina_list_append(img_location_list, duplicate);
    if (eina_error_get()) 
        goto error;


// Out of memory handling.
error:
    CRITICAL("Could not allocate memory.");
    EINA_LIST_FREE(img_location_list, data)
        free(data);
    return 0;

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list