summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/pulse/xmalloc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/pulse/xmalloc.c b/src/pulse/xmalloc.c
index 28490975..a64761bf 100644
--- a/src/pulse/xmalloc.c
+++ b/src/pulse/xmalloc.c
@@ -29,6 +29,7 @@
#include <signal.h>
#include <unistd.h>
#include <string.h>
+#include <errno.h>
#include <pulse/gccmacro.h>
#include <pulsecore/core-util.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;
}