Fixed memory leak
This commit is contained in:
parent
f60cdc0167
commit
b560f77969
@ -450,16 +450,15 @@ void wofi_write_cache(const gchar* mode, const gchar* cmd) {
|
|||||||
free(line);
|
free(line);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
}
|
}
|
||||||
|
char* tmp_path = strdup(cache_path);
|
||||||
|
char* dir = dirname(tmp_path);
|
||||||
|
|
||||||
|
if(access(dir, W_OK) == 0) {
|
||||||
if(!inc_count) {
|
if(!inc_count) {
|
||||||
struct cache_line* node = malloc(sizeof(struct cache_line));
|
struct cache_line* node = malloc(sizeof(struct cache_line));
|
||||||
node->line = utils_concat(3, "1 ", cmd, "\n");
|
node->line = utils_concat(3, "1 ", cmd, "\n");
|
||||||
wl_list_insert(&lines, &node->link);
|
wl_list_insert(&lines, &node->link);
|
||||||
}
|
}
|
||||||
|
|
||||||
char* tmp_path = strdup(cache_path);
|
|
||||||
char* dir = dirname(tmp_path);
|
|
||||||
|
|
||||||
if(access(dir, W_OK) == 0) {
|
|
||||||
FILE* file = fopen(cache_path, "w");
|
FILE* file = fopen(cache_path, "w");
|
||||||
struct cache_line* node, *tmp;
|
struct cache_line* node, *tmp;
|
||||||
wl_list_for_each_safe(node, tmp, &lines, link) {
|
wl_list_for_each_safe(node, tmp, &lines, link) {
|
||||||
|
Loading…
Reference in New Issue
Block a user