Subj : Htick Hatching To : andrew clarke From : Michael Dukelsky Date : Fri Mar 12 2021 15:29:34 Hello andrew, Friday March 12 2021, andrew clarke wrote to Michael Dukelsky: PH>>>>> double free or corruption (fasttop) PH>>>>> Aborted ac>>> This is likely due to free() being called twice on the same ac>>> pointer somewhere in the Linux build of HTick. MD>> OK, thank you. It should be easy to fix. ac> nfree() may help but it's not foolproof. Consider this: ac> #include ac> #include ac> #include ac> #define nfree(a) {if(a != NULL) {free(a); a = NULL;}} ac> static void foo(char *p) ac> { ac> printf("%s\n", p); ac> nfree(p); ac> } ac> int main(void) ac> { ac> char *p = malloc(42); ac> strcpy(p, "Hello!"); ac> foo(p); ac> nfree(p); ac> return 0; ac> } ac> Here foo() can only set its local copy of p to NULL. It can't modify ac> the original pointer. ac> There's not really any way around this kind of mistake in C, other ac> than to run it through a debugger, examine the code and fix it by ac> hand. We'll wait for Paul to test it. Michael .... node (at) f1042 (dot) ru --- GoldED+/LNX 1.1.5-b20180707 * Origin: Moscow, Russia (2:5020/1042) .