diff options
Diffstat (limited to 'src/pulse/xmalloc.c')
-rw-r--r-- | src/pulse/xmalloc.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/pulse/xmalloc.c b/src/pulse/xmalloc.c index 5348dda41..a64761bfa 100644 --- a/src/pulse/xmalloc.c +++ b/src/pulse/xmalloc.c @@ -29,9 +29,10 @@ #include <signal.h> #include <unistd.h> #include <string.h> +#include <errno.h> +#include <pulse/gccmacro.h> #include <pulsecore/core-util.h> -#include <pulsecore/gccmacro.h> #include <pulsecore/macro.h> #include "xmalloc.h" @@ -123,8 +124,12 @@ char *pa_xstrndup(const char *s, size_t l) { } void pa_xfree(void *p) { + int saved_errno; + if (!p) return; + saved_errno = errno; free(p); + errno = saved_errno; } |