Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Parser] free(): double free detected in tcache 2 #48

Open
wesuRage opened this issue Dec 9, 2024 · 0 comments
Open

[Parser] free(): double free detected in tcache 2 #48

wesuRage opened this issue Dec 9, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@wesuRage
Copy link
Contributor

wesuRage commented Dec 9, 2024

$  ./src/frontend/parser/parser_test examples/a.glx 
Lexical Analysis:
-----------------
Line 1, Column 1-4: TYPE INTEGER "int"
Line 1, Column 5-7: IDENTIFIER "oi"
Line 1, Column 8-10: ASSIGN ":="
Line 1, Column 10-11: NUMBER "3"
Line 1, Column 11-12: SEMICOLON ";"
Line 1, Column 12-12: END OF FILE "EOF"

Parsing:
-----------------
AST:
Node Type: Program
  Program has 1 statements
  Node Type: Variable Declaration
    Variable Name: oi
    Is Pointer: false
    Is Constant: false
    Type: int
    Value:
      Node Type: Numeric Literal
        Value: 3.000000
free(): double free detected in tcache 2
Aborted (core dumped)

running the backtrace on gdb:

Program received signal SIGABRT, Aborted.
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
warning: 44     ./nptl/pthread_kill.c: No such file or directory
(gdb) backtrace
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
#1  0x00007ffff7e44ebf in __pthread_kill_internal (threadid=<optimized out>, signo=6) at ./nptl/pthread_kill.c:78
#2  0x00007ffff7df0c82 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007ffff7dd94f0 in __GI_abort () at ./stdlib/abort.c:79
#4  0x00007ffff7dda32d in __libc_message_impl (fmt=fmt@entry=0x7ffff7f5c303 "%s\n") at ../sysdeps/posix/libc_fatal.c:132
#5  0x00007ffff7e4e9e5 in malloc_printerr (str=str@entry=0x7ffff7f5f6a8 "free(): double free detected in tcache 2") at ./malloc/malloc.c:5772
#6  0x00007ffff7e50e59 in _int_free (av=0x7ffff7f98ac0 <main_arena>, p=<optimized out>, have_lock=have_lock@entry=0) at ./malloc/malloc.c:4541
#7  0x00007ffff7e534ff in __GI___libc_free (mem=<optimized out>) at ./malloc/malloc.c:3398
#8  0x000055555555e2f5 in freeTokens (tokens=0x555555565bd0, tokenCount=6) at /root/C/galaxy/src/frontend/freeTokens.c:19
#9  0x00005555555554e5 in main (argc=2, argv=0x7fffffffda68) at /root/C/galaxy/src/frontend/parser/parser.test.c:59
(gdb) 

as said on gdb, the line 19 of freeTokens.c is: free(tokens[i].lexeme);

@wesuRage wesuRage added the bug Something isn't working label Dec 9, 2024
@wesuRage wesuRage changed the title free(): double free detected in tcache 2 [Parser] free(): double free detected in tcache 2 Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant