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:
parent
e656688fbe
commit
a26710f497
13
src/util.c
13
src/util.c
@ -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)
|
||||
{
|
||||
|
11
src/util.h
11
src/util.h
@ -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__ */
|
||||
|
Loading…
Reference in New Issue
Block a user