Skip to content
Snippets Groups Projects
Commit 9631bc1a authored by Florian Burgener's avatar Florian Burgener
Browse files

Fix memory leak

parent e9f998f9
Branches
No related tags found
No related merge requests found
......@@ -177,8 +177,11 @@ PlacingStatus connect4_play_smart(Connect4 *connect4, void (*on_piece_placed)(Co
}
if (connect4_check_win(copied_connect4, x, y, current_player)) {
connect4_destroy(copied_connect4);
return connect4_play(connect4, x + 1, on_piece_placed);
}
connect4_destroy(copied_connect4);
}
current_player = change_player(current_player);
......
CC = gcc
CCFLAGS = -g -Wall -Wextra -pedantic -fsanitize=address -fsanitize=leak
Connect4.o: Connect4.c
gcc -c $< -o $@
$(CC) $(CCFLAGS) -c $< -o $@
random.o: random.c
gcc -c $< -o $@
$(CC) $(CCFLAGS) -c $< -o $@
main.o: main.c
gcc -c $< -o $@
$(CC) $(CCFLAGS) -c $< -o $@
puissance4: main.o Connect4.o random.o
gcc -o puissance4 main.o Connect4.o random.o
$(CC) $(CCFLAGS) -o puissance4 main.o Connect4.o random.o
clean:
rm -f *.o
rm -f puissance4
rm -f *.o puissance4
$(MAKE) -C testbed clean
tests: puissance4
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment