Skip to content

Instantly share code, notes, and snippets.

@lovemycodesnippets
Created March 11, 2025 14:40
Show Gist options
  • Save lovemycodesnippets/b348ed6d5790da9eaf1936bf7fa4ec8d to your computer and use it in GitHub Desktop.
Save lovemycodesnippets/b348ed6d5790da9eaf1936bf7fa4ec8d to your computer and use it in GitHub Desktop.
From the TNS post on TrapC
int main()
{ int* p = malloc(sizeof(int));
free(p);//TrapC ignores free, p not freed yet
*p = 10;//UB in C, no problem in TrapC
return 0;//Leaving Scope, TrapC now frees p automatically
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment