Skip to content

Commit

Permalink
Valgrind cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
Vagabond committed May 8, 2014
1 parent a3dc5aa commit a61aa15
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/console/console.c
Expand Up @@ -207,6 +207,7 @@ int console_init() {
con->output_pos = 0;
con->output_overflowing = 0;
con->histpos = -1;
con->histpos_changed = 0;
list_create(&con->history);
hashmap_create(&con->cmds, 8);
menu_background_create(&con->background, 322, 101);
Expand Down
1 change: 1 addition & 0 deletions src/controller/keyboard.c
Expand Up @@ -77,6 +77,7 @@ int keyboard_binds_key(controller *ctrl, SDL_Event *event) {
void keyboard_create(controller *ctrl, keyboard_keys *keys, int delay) {
keyboard *k = malloc(sizeof(keyboard));
k->keys = keys;
k->last = 0;
ctrl->data = k;
ctrl->type = CTRL_TYPE_KEYBOARD;
ctrl->poll_fun = &keyboard_poll;
Expand Down
6 changes: 6 additions & 0 deletions src/game/scenes/arena.c
Expand Up @@ -636,8 +636,14 @@ void arena_free(scene *scene) {
//game_player_set_ctrl(player, NULL);
controller_set_repeat(game_player_get_ctrl(player), 0);

for (int j = 0; j < 4; j++) {
if (j < ceil(local->rounds / 2.0f)) {
free(local->player_rounds[i][j]);
}
}
}


textbutton_free(&local->title_button);
textbutton_free(&local->return_button);
textslider_free(&local->sound_slider);
Expand Down
4 changes: 3 additions & 1 deletion src/game/scenes/cutscene.c
Expand Up @@ -77,7 +77,9 @@ void cutscene_render_overlay(scene *scene) {
}

void cutscene_free(scene *scene) {
free(scene_get_userdata(scene));
cutscene_local *local = scene_get_userdata(scene);
free(local->text);
free(local);
}

void cutscene_startup(scene *scene, int id, int *m_load, int *m_repeat) {
Expand Down
1 change: 1 addition & 0 deletions src/game/scenes/vs.c
Expand Up @@ -65,6 +65,7 @@ void vs_free(scene *scene) {
game_player *player2 = game_state_get_player(scene->gs, 1);

dialog_free(&local->quit_dialog);
dialog_free(&local->too_pathetic_dialog);
surface_free(&local->arena_select_bg);
object_free(&local->player1_portrait);
object_free(&local->player2_portrait);
Expand Down
2 changes: 1 addition & 1 deletion src/game/utils/score.c
Expand Up @@ -117,12 +117,12 @@ void chr_score_tick(chr_score *score) {
if (t->age > SLIDER_HANG_TIME) {
t->position -= 0.01f;
}
lastage = t->age++;
if(t->position < 0.0f) {
score->score += t->points;
free(t->text);
list_delete(&score->texts, &it);
}
lastage = t->age++;
}
}

Expand Down

0 comments on commit a61aa15

Please sign in to comment.