1
0
mirror of https://gitlab.xiph.org/xiph/ezstream.git synced 2025-01-03 14:56:35 -05:00

Replace the very broken xfree() function with an xfree() macro - the main point

was to set ptr to NULL, but the function only set the copy of ptr to NULL.
Spotted by Karl Heyes, thanks a lot!


git-svn-id: https://svn.xiph.org/trunk/ezstream@12677 0101bb08-14d6-0310-b084-bc0e0c8e3800
This commit is contained in:
moritz 2007-03-08 01:12:13 +00:00
parent e656688fbe
commit a26710f497
2 changed files with 10 additions and 14 deletions

View File

@ -113,19 +113,6 @@ xrealloc(void *ptr, size_t nmemb, size_t size)
return (ret);
}
void
xfree(void *ptr)
{
if (ptr == NULL) {
printf("%s: xfree(): Internal error: NULL argument\n",
__progname);
abort();
}
free(ptr);
ptr = NULL;
}
char *
xstrdup(const char *str)
{

View File

@ -20,8 +20,17 @@
void * xmalloc(size_t /* size */);
void * xcalloc(size_t /* nmemb */, size_t /* size */);
void * xrealloc(void *, size_t /* nmemb */, size_t /* size */);
void xfree(void *);
char * xstrdup(const char *);
int strrcmp(const char *, const char *);
#define xfree(ptr) do { \
if ((ptr) == NULL) { \
printf("%s: xfree(): Internal error: NULL argument\n", \
__progname); \
abort(); \
} \
free(ptr); \
(ptr) = NULL; \
} while (0)
#endif /* __UTIL_H__ */