mirror of
https://github.com/theoludwig/programming-challenges.git
synced 2025-05-18 12:02:53 +02:00
fix(solutions): memory issues thanks to -fsanitize=address flag with gcc
This commit is contained in:
@ -20,7 +20,7 @@ bool is_integer(char* string) {
|
||||
|
||||
int main() {
|
||||
char* string = input();
|
||||
struct Stack* stack = stack_initialization();
|
||||
struct stack* stack = stack_initialization();
|
||||
char* token = strtok(string, " ");
|
||||
while (token != NULL) {
|
||||
if (is_integer(token)) {
|
||||
@ -45,5 +45,7 @@ int main() {
|
||||
token = strtok(NULL, " ");
|
||||
}
|
||||
printf("%ld\n", (intptr_t)stack_pop(stack));
|
||||
free(string);
|
||||
stack_free(stack);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
Reference in New Issue
Block a user