[pulseaudio-commits] r1582 - /branches/lennart/src/pulsecore/pstream.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Mon Aug 6 10:38:00 PDT 2007


Author: lennart
Date: Mon Aug  6 19:37:59 2007
New Revision: 1582

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=3D1582&root=3Dpulseaudio&vi=
ew=3Drev
Log:
fix a memory leak

Modified:
    branches/lennart/src/pulsecore/pstream.c

Modified: branches/lennart/src/pulsecore/pstream.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
pstream.c?rev=3D1582&root=3Dpulseaudio&r1=3D1581&r2=3D1582&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/pstream.c (original)
+++ branches/lennart/src/pulsecore/pstream.c Mon Aug  6 19:37:59 2007
@@ -274,7 +274,7 @@
     return p;
 }
 =

-static void item_free(void *item, PA_GCC_UNUSED void *p) {
+static void item_free(void *item, PA_GCC_UNUSED void *q) {
     struct item_info *i =3D item;
     pa_assert(i);
 =

@@ -299,14 +299,14 @@
     if (p->write.current)
         item_free(p->write.current, NULL);
 =

+    if (p->write.memchunk.memblock)
+        pa_memblock_unref(p->write.memchunk.memblock);
+
     if (p->read.memblock)
         pa_memblock_unref(p->read.memblock);
 =

     if (p->read.packet)
         pa_packet_unref(p->read.packet);
-
-    if (p->write.memchunk.memblock)
-        pa_memblock_unref(p->write.memchunk.memblock);
 =

     pa_xfree(p);
 }
@@ -568,8 +568,13 @@
 =

     if (p->write.index >=3D PA_PSTREAM_DESCRIPTOR_SIZE + ntohl(p->write.de=
scriptor[PA_PSTREAM_DESCRIPTOR_LENGTH])) {
         pa_assert(p->write.current);
-        item_free(p->write.current, (void *) 1);
+        item_free(p->write.current, NULL);
         p->write.current =3D NULL;
+
+        if (p->write.memchunk.memblock)
+            pa_memblock_unref(p->write.memchunk.memblock);
+
+        pa_memchunk_reset(&p->write.memchunk);
 =

         if (p->drain_callback && !pa_pstream_is_pending(p))
             p->drain_callback(p, p->drain_callback_userdata);




More information about the pulseaudio-commits mailing list