[pulseaudio-commits] r1253 - /trunk/src/modules/module-zeroconf-publish.c
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Sun Aug 13 13:44:33 PDT 2006
Author: lennart
Date: Sun Aug 13 22:44:32 2006
New Revision: 1253
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1253&root=pulseaudio&view=rev
Log:
fix a segfault when registering a service with avahi fails
Modified:
trunk/src/modules/module-zeroconf-publish.c
Modified: trunk/src/modules/module-zeroconf-publish.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-zeroconf-publish.c?rev=1253&root=pulseaudio&r1=1252&r2=1253&view=diff
==============================================================================
--- trunk/src/modules/module-zeroconf-publish.c (original)
+++ trunk/src/modules/module-zeroconf-publish.c Sun Aug 13 22:44:32 2006
@@ -225,9 +225,8 @@
if (s->published == UNPUBLISHED) {
/* Remove this service */
- if (s->entry_group) {
+ if (s->entry_group)
avahi_entry_group_free(s->entry_group);
- }
pa_hashmap_remove(u->services, s->name);
pa_xfree(s->name);
@@ -263,6 +262,7 @@
static int publish_sink(struct userdata *u, pa_sink *s) {
struct service *svc;
+ int ret;
assert(u && s);
svc = get_service(u, s->name);
@@ -273,13 +273,17 @@
svc->loaded.type = PA_NAMEREG_SINK;
svc->loaded.index = s->index;
+ if ((ret = publish_service(u, svc)) < 0)
+ return ret;
+
pa_dynarray_put(u->sink_dynarray, s->index, svc);
-
- return publish_service(u, svc);
+ return ret;
}
static int publish_source(struct userdata *u, pa_source *s) {
struct service *svc;
+ int ret;
+
assert(u && s);
svc = get_service(u, s->name);
@@ -292,11 +296,17 @@
pa_dynarray_put(u->source_dynarray, s->index, svc);
- return publish_service(u, svc);
+ if ((ret = publish_service(u, svc)) < 0)
+ return ret;
+
+ pa_dynarray_put(u->sink_dynarray, s->index, svc);
+ return ret;
}
static int publish_autoload(struct userdata *u, pa_autoload_entry *s) {
struct service *svc;
+ int ret;
+
assert(u && s);
svc = get_service(u, s->name);
@@ -307,9 +317,11 @@
svc->autoload.type = s->type;
svc->autoload.index = s->index;
+ if ((ret = publish_service(u, svc)) < 0)
+ return ret;
+
pa_dynarray_put(u->autoload_dynarray, s->index, svc);
-
- return publish_service(u, svc);
+ return ret;
}
static int remove_sink(struct userdata *u, uint32_t idx) {
@@ -653,6 +665,9 @@
if (u->services)
pa_hashmap_free(u->services, service_free, u);
+ if (u->subscription)
+ pa_subscription_free(u->subscription);
+
if (u->sink_dynarray)
pa_dynarray_free(u->sink_dynarray, NULL, NULL);
if (u->source_dynarray)
@@ -660,8 +675,6 @@
if (u->autoload_dynarray)
pa_dynarray_free(u->autoload_dynarray, NULL, NULL);
- if (u->subscription)
- pa_subscription_free(u->subscription);
if (u->main_entry_group)
avahi_entry_group_free(u->main_entry_group);
More information about the pulseaudio-commits
mailing list