Skip to content

Commit 5dc541e

Browse files
committed
Allow FREE(NULL) to match standard C behavior
The previous implementation of FREE would call exit_failure() if passed a NULL pointer. This caused fatal crashes in several core functions (such as Link_download_full) that rely on FREE(NULL) being a no-op, especially during first-iteration loop resets and error-path cleanups. Aligning FREE with standard free() behavior improves overall system stability and prevents minor logic patterns from triggering total application failure.
1 parent ed5e9fa commit 5dc541e

1 file changed

Lines changed: 0 additions & 2 deletions

File tree

src/util.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,6 @@ void FREE(void *ptr)
254254
{
255255
if (ptr) {
256256
free(ptr);
257-
} else {
258-
lprintf(fatal, "attempted to free NULL ptr!\n");
259257
}
260258
}
261259

0 commit comments

Comments
 (0)