$OpenBSD: patch-src_pulsecore_lock-autospawn_c,v 1.2 2013/11/21 18:08:09 stsp Exp $
https://bugs.freedesktop.org/show_bug.cgi?id=71738
--- src/pulsecore/lock-autospawn.c.orig	Wed Oct 30 10:21:47 2013
+++ src/pulsecore/lock-autospawn.c	Wed Oct 30 10:59:58 2013
@@ -114,8 +114,13 @@ static void unref(pa_bool_t after_fork) {
     if (n_ref > 0)
         return;
 
+    /* Call pa_thread_free() only in the process the thread was created in
+     * to avoid undefined behaviour.
+     * POSIX.1-2008 XSH 2.9.2 Thread IDs: "applications should only assume
+     * that thread IDs are usable and unique within a single process." */
     if (thread) {
-        pa_thread_free(thread);
+        if (!after_fork)
+            pa_thread_free(thread);
         thread = NULL;
     }
 
