diff --git a/src/pulse/xmalloc.c b/src/pulse/xmalloc.c index 284909751..a64761bfa 100644 --- a/src/pulse/xmalloc.c +++ b/src/pulse/xmalloc.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -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; }