split_string memory leaks cleanedup

master
taiyu 9 years ago
parent 9a7f48f872
commit c8415d7fef

@ -4,8 +4,11 @@
char *strip_whitespace(char *str, int *trimmed_start);
char *strip_comments(char *str);
// Must be freed with free_flat_list
list_t *split_string(const char *str, const char *delims);
void free_flat_list(list_t *list);
char *code_strchr(const char *string, char delimiter);
char *code_strstr(const char *haystack, const char *needle);
int unescape_string(char *string);

@ -129,7 +129,7 @@ static bool cmd_bindsym(struct sway_config *config, int argc, char **argv) {
*key = sym;
list_add(binding->keys, key);
}
list_free(split);
free_flat_list(split);
// TODO: Check if there are other commands with this key binding
struct sway_mode *mode = config->current_mode;
@ -268,7 +268,7 @@ static bool cmd_floating_mod(struct sway_config *config, int argc, char **argv)
}
}
}
list_free(split);
free_flat_list(split);
if (!config->floating_mod) {
sway_log(L_ERROR, "bindsym - unknown keys %s", argv[0]);
return false;

@ -131,6 +131,7 @@ static char *get_config_path() {
strcpy(test, paths->items[i]);
strcat(test, name);
if (exists(test)) {
free_config(temp_config);
free_flat_list(paths);
return test;
}
@ -225,7 +226,7 @@ bool read_config(FILE *file, bool is_active) {
success = false;
temp_config->failed = true;
}
list_free(args);
free_flat_list(args);
_continue:
if (line && line[strlen(line) - 1] == '{') {

@ -42,22 +42,22 @@ char *workspace_next_name(void) {
strcmp(target, "back_and_forth") == 0 ||
strcmp(target, "current") == 0)
{
list_free(args);
free_flat_list(args);
continue;
}
// Make sure that the workspace doesn't already exist
if (workspace_by_name(target)) {
list_free(args);
free_flat_list(args);
continue;
}
list_free(args);
free_flat_list(args);
sway_log(L_DEBUG, "Workspace: Found free name %s", target);
return target;
}
list_free(args);
free_flat_list(args);
}
// As a fall back, get the current number of active workspaces
// and return that + 1 for the next workspace's name

Loading…
Cancel
Save