free log_entries in wm_exit
This commit is contained in:
parent
5cbe15a899
commit
06c25ff838
21
src/util.c
21
src/util.c
@ -242,6 +242,7 @@ json_object* wm_state_to_json_object(Wm *wm)
|
|||||||
free(ws_with_index->str);
|
free(ws_with_index->str);
|
||||||
free(ws_with_index);
|
free(ws_with_index);
|
||||||
}
|
}
|
||||||
|
wm_uintarray_free(ws_str);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -256,7 +257,7 @@ void wm_log_state(Wm *wm, const char *prefixstr, const char* logfile)
|
|||||||
char prefix[WM_PREFIX_LEN + 32] = {0};
|
char prefix[WM_PREFIX_LEN + 32] = {0};
|
||||||
snprintf(prefix, sizeof(prefix), "%lu:%s", time(NULL), prefixstr);
|
snprintf(prefix, sizeof(prefix), "%lu:%s", time(NULL), prefixstr);
|
||||||
|
|
||||||
json_object *log_entry_obj = wm_state_to_json_object(wm, prefixstr);
|
json_object *log_entry_obj = wm_state_to_json_object(wm);
|
||||||
|
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
struct json_object *jobj = NULL;
|
struct json_object *jobj = NULL;
|
||||||
@ -788,11 +789,12 @@ static void recursive_mkdir(char *path, mode_t mode)
|
|||||||
|
|
||||||
void wm_logfile_init(const char *path)
|
void wm_logfile_init(const char *path)
|
||||||
{
|
{
|
||||||
char *dup = strdup(path);
|
|
||||||
char *log_file_dir = dirname(dup);
|
|
||||||
|
|
||||||
if (access(path, F_OK) == 0) return;
|
if (access(path, F_OK) == 0) return;
|
||||||
|
|
||||||
|
char *dup = strdup(path);
|
||||||
|
char *log_file_dir = dirname(dup);
|
||||||
|
|
||||||
int ret = access(log_file_dir, W_OK | R_OK);
|
int ret = access(log_file_dir, W_OK | R_OK);
|
||||||
|
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
@ -1373,7 +1375,18 @@ void wm_logentries_free(UIntArray *entries)
|
|||||||
|
|
||||||
for (size_t j = 0; j < entry->workspaces->size; j++) {
|
for (size_t j = 0; j < entry->workspaces->size; j++) {
|
||||||
TreeNode *node = entry->workspaces->nodes[j];
|
TreeNode *node = entry->workspaces->nodes[j];
|
||||||
if (node != NULL) wm_treenode_free(node);
|
if (node == NULL) continue;
|
||||||
|
|
||||||
|
NodeArray *children = wm_postorder_traversal(node);
|
||||||
|
for (size_t k = 0; k < children->size; k++) {
|
||||||
|
if (children->nodes[k]->type == NODE_CLIENT) {
|
||||||
|
free(children->nodes[k]->client->name);
|
||||||
|
free(children->nodes[k]->client);
|
||||||
|
}
|
||||||
|
wm_treenode_free(children->nodes[k]);
|
||||||
|
}
|
||||||
|
|
||||||
|
wm_nodearray_free(children);
|
||||||
}
|
}
|
||||||
|
|
||||||
wm_nodearray_free(entry->workspaces);
|
wm_nodearray_free(entry->workspaces);
|
||||||
|
2
src/wm.c
2
src/wm.c
@ -535,6 +535,8 @@ void wm_exit(Wm *wm)
|
|||||||
XftColorFree(wm->display, visual, cmap, &wm->titlebar_text_color);
|
XftColorFree(wm->display, visual, cmap, &wm->titlebar_text_color);
|
||||||
XftFontClose(wm->display, wm->titlebar_font);
|
XftFontClose(wm->display, wm->titlebar_font);
|
||||||
|
|
||||||
|
wm_logentries_free(wm->log_entries);
|
||||||
|
|
||||||
XCloseDisplay(wm->display);
|
XCloseDisplay(wm->display);
|
||||||
|
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user