rem: free(directory_name); free(directory); free(file);
add: wfree(directory_name); wfree(directory); wfree(file);
context: createDir(WMButton *bPre, WMFilePanel *panel){    char *directory_name;    char *directory;    char *file;    char *s;    WMScreen *scr = WMWidgetScreen(panel->win);    WMInputPanel *_panel;    _panel = WMCreateInputPanel(scr, panel->win,            "Create Directory", "Enter directory name", "", "OK", "Cancel");    scr->modalView = W_VIEW(_panel->win);    WMMapWidget(_panel->win);    scr->modal = 1;    while (!_panel->done || WMScreenPending(scr)) {        XEvent event;        WMNextEvent(scr->display, &event);        WMHandleEvent(&event);    }    scr->modal = 0;    if (_panel->result == WAPRDefault)        directory_name = WMGetTextFieldText(_panel->text);    else {        WMDestroyInputPanel(_panel);        return;    }    WMDestroyInputPanel(_panel);    directory = getCurrentFileName(panel);    {        char *s = strrchr(directory,'/');        if (s) s[1] = 0;    }    if (directory_name[0] == '/') {        directory[0] = 0;    } else {        while ((s = strstr(directory,"//"))) {            int i;            for (i = 2;s[i] == '/';i++);            strcpy(s, &s[i-1]);        }        if ((s = strrchr(directory, '/')) && !s[1]) s[0] = 0;    }    while ((s = strstr(directory_name,"//"))) {        int i;        for (i = 2;s[i] == '/';i++);        strcpy(s, &s[i-1]);    }    if ((s = strrchr(directory_name, '/')) && !s[1]) s[0] = 0;    file = wmalloc(strlen(directory_name)+strlen(directory)+1);    sprintf(file, "%s/%s", directory, directory_name);    while ((s = strstr(file,"//"))) {        int i;        for (i = 2;s[i] == '/';i++);        strcpy(s, &s[i-1]);    }    if (mkdir(file,0xfff) != 0) {        switch (errno) {            case EACCES:                showError(scr, panel->win, "Permission denied.", NULL);                break;            case EEXIST:                showError(scr, panel->win, "'%s' already existes.", file);                break;            case ENOENT:                showError(scr, panel->win, "Path does not exist.", NULL);        }    }    else WMSetFilePanelDirectory(panel, file);    free(directory_name);    free(directory);    free(file);}