Fix: memory leaks reported by valingrid

This commit is contained in:
jcorporation 2019-01-28 20:49:46 +01:00
parent d1959e8418
commit c587a120d0
2 changed files with 9 additions and 3 deletions

View File

@ -822,6 +822,7 @@ static void mpd_client_api(t_config *config, t_mpd_state *mpd_state, void *arg_r
len = mpd_client_search(config, mpd_state, buffer, p_charbuf1, p_charbuf2, p_charbuf3, uint_buf1);
free(p_charbuf1);
free(p_charbuf2);
free(p_charbuf3);
}
break;
case MPD_API_DATABASE_SEARCH_ADV:
@ -2656,6 +2657,7 @@ static int mpd_client_smartpls_put(t_config *config, char *buffer, const char *p
len = json_printf(&out, "{type: error, data: %Q}}", "Unknown smart playlist type");
printf("Unknown smart playlist type: %s\n", pl_file);
}
free(content);
return len;
}

View File

@ -275,13 +275,17 @@ static bool mympd_api_read_syscmds(t_config *config, t_mympd_state *mympd_state)
if (strncmp(ent->d_name, ".", 1) == 0)
continue;
order = strtol(ent->d_name, &cmd, 10);
if (strcmp(cmd, "") != 0)
list_push(&mympd_state->syscmd_list, strdup(cmd), order);
if (strcmp(cmd, "") != 0) {
list_push(&mympd_state->syscmd_list, cmd, order);
}
else {
printf("ERROR: Can't read syscmd file %s\n", ent->d_name);
}
}
closedir(dir);
}
else {
printf("ERROR: Can't read syscmds");
printf("ERROR: Can't read syscmds\n");
}
}
else {