]> code.delx.au - pulseaudio/commitdiff
introspect: Fix two memory issues in port handling code.
authorColin Guthrie <cguthrie@mandriva.org>
Sun, 12 Jul 2009 19:43:21 +0000 (20:43 +0100)
committerColin Guthrie <cguthrie@mandriva.org>
Sun, 12 Jul 2009 20:07:58 +0000 (21:07 +0100)
First one is a simple typo on an error condition that would have likely caused issues if it ever cropped up.
Second issue is that port information is never actually freed if everything works fine.

src/pulse/introspect.c

index 3414f7de60b02823c0cf79e23daa96c565582736..27a587cb4ea15806ec369179121722475af8a1f3 100644 (file)
@@ -212,8 +212,8 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, u
                             pa_tagstruct_getu32(t, &i.ports[0][j].priority) < 0) {
 
                             pa_context_fail(o->context, PA_ERR_PROTOCOL);
-                            pa_xfree(i.ports);
                             pa_xfree(i.ports[0]);
+                            pa_xfree(i.ports);
                             pa_proplist_free(i.proplist);
                             goto finish;
                         }
@@ -250,6 +250,10 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, u
                 cb(o->context, &i, 0, o->userdata);
             }
 
+            if (i.ports) {
+                pa_xfree(i.ports[0]);
+                pa_xfree(i.ports);
+            }
             pa_proplist_free(i.proplist);
         }
     }
@@ -479,6 +483,10 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command,
                 cb(o->context, &i, 0, o->userdata);
             }
 
+            if (i.ports) {
+                pa_xfree(i.ports[0]);
+                pa_xfree(i.ports);
+            }
             pa_proplist_free(i.proplist);
         }
     }