Explorar o código

make tdestroy allow null function pointer if no destructor is needed

this change is to align with a change in the glibc interface.
Rich Felker %!s(int64=11) %!d(string=hai) anos
pai
achega
d3a98ff69a
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/search/tdestroy.c

+ 1 - 1
src/search/tdestroy.c

@@ -16,6 +16,6 @@ void tdestroy(void *root, void (*freekey)(void *))
 		return;
 	tdestroy(r->left, freekey);
 	tdestroy(r->right, freekey);
-	freekey(r->key);
+	if (freekey) freekey(r->key);
 	free(r);
 }