]> code.delx.au - pulseaudio/blobdiff - src/memblock.c
implement recording in native API
[pulseaudio] / src / memblock.c
index af57e3a48f23cb2f26f667523113385f70118594..2dfa6a9c1bddda47eb034766087e3fe0734a37ec 100644 (file)
@@ -69,12 +69,13 @@ void pa_memblock_unref_fixed(struct pa_memblock *b) {
     if (b->ref == 1) {
         pa_memblock_unref(b);
         return;
+    } else {
+        d = malloc(b->length);
+        assert(d);
+        memcpy(d, b->data, b->length);
+        b->data = d;
+        b->type = PA_MEMBLOCK_DYNAMIC;
+        b->ref--;
     }
-
-    d = malloc(b->length);
-    assert(d);
-    memcpy(d, b->data, b->length);
-    b->data = d;
-    b->type = PA_MEMBLOCK_DYNAMIC;
 }