[Webkit-unassigned] [Bug 40541] New: Two memory leaks

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Jun 13 00:26:36 PDT 2010


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

           Summary: Two memory leaks
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P1
         Component: WebKit Gtk
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: genhua.liu at access-company.com


The following two file has memory leaks:
File: webkitwebview.cpp

// Internal subresource management
void webkit_web_view_add_resource(WebKitWebView* webView, char* identifier, WebKitWebResource* webResource)
{
    WebKitWebViewPrivate* priv = webView->priv;

    if (!priv->mainResource) {
        priv->mainResource = webResource;
        priv->mainResourceIdentifier = g_strdup(identifier);   
        return;
    }

    g_hash_table_insert(priv->subResources, identifier, webResource);
}

should be fixed as: 
priv->mainResourceIdentifier = identifier;   


File: FileSystemGtk.cpp
Vector<String> listDirectory(const String& path, const String& filter)
{
    Vector<String> entries;

    gchar* filename = filenameFromString(path);
    GDir* dir = g_dir_open(filename, 0, 0);
    if (!dir)
        return entries;

    GPatternSpec *pspec = g_pattern_spec_new((filter.utf8()).data());
    while (const char* name = g_dir_read_name(dir)) {
        if (!g_pattern_match_string(pspec, name))
            continue;

        gchar* entry = g_build_filename(filename, name, NULL);
        entries.append(filenameToString(entry));
        g_free(entry);
    }
    g_dir_close(dir);
    g_free(filename);

    return entries;
}

should be fixed as:
1.  if (!dir) {
        g_free(filename);
        return entries;
    }    
2.   
    g_dir_close(dir);
    //add pspec free here
    g_pattern_spec_free(pspec);
    g_free(filename);

-- 
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