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);
|
||||
}
|
||||
wm_uintarray_free(ws_str);
|
||||
|
||||
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};
|
||||
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;
|
||||
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)
|
||||
{
|
||||
char *dup = strdup(path);
|
||||
char *log_file_dir = dirname(dup);
|
||||
|
||||
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);
|
||||
|
||||
if (ret == 0) {
|
||||
@ -1373,7 +1375,18 @@ void wm_logentries_free(UIntArray *entries)
|
||||
|
||||
for (size_t j = 0; j < entry->workspaces->size; 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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user