summaryrefslogtreecommitdiff
path: root/src/modules/rtp
diff options
context:
space:
mode:
authorTanu Kaskinen <tanu.kaskinen@linux.intel.com>2014-03-26 17:39:48 +0200
committerTanu Kaskinen <tanu.kaskinen@linux.intel.com>2014-04-17 10:06:23 +0300
commiteca082a93f2619cfa10733947a81fa779cb49573 (patch)
treee97621d7180832fb493c219a3db044a25c11a89b /src/modules/rtp
parent14e2553185e1afa93737586771326cd12a154239 (diff)
downloadpulseaudio-eca082a93f2619cfa10733947a81fa779cb49573.tar.gz
Use pa_hashmap_remove_and_free() where appropriate
Diffstat (limited to 'src/modules/rtp')
-rw-r--r--src/modules/rtp/headerlist.c8
-rw-r--r--src/modules/rtp/module-rtp-recv.c14
2 files changed, 5 insertions, 17 deletions
diff --git a/src/modules/rtp/headerlist.c b/src/modules/rtp/headerlist.c
index 11e076eed..3ed406274 100644
--- a/src/modules/rtp/headerlist.c
+++ b/src/modules/rtp/headerlist.c
@@ -129,16 +129,10 @@ const char *pa_headerlist_gets(pa_headerlist *p, const char *key) {
}
int pa_headerlist_remove(pa_headerlist *p, const char *key) {
- struct header *hdr;
-
pa_assert(p);
pa_assert(key);
- if (!(hdr = pa_hashmap_remove(MAKE_HASHMAP(p), key)))
- return -1;
-
- header_free(hdr);
- return 0;
+ return pa_hashmap_remove_and_free(MAKE_HASHMAP(p), key);
}
const char *pa_headerlist_iterate(pa_headerlist *p, void **state) {
diff --git a/src/modules/rtp/module-rtp-recv.c b/src/modules/rtp/module-rtp-recv.c
index 9dc2febea..e1b6929d6 100644
--- a/src/modules/rtp/module-rtp-recv.c
+++ b/src/modules/rtp/module-rtp-recv.c
@@ -190,8 +190,7 @@ static void sink_input_kill(pa_sink_input* i) {
pa_sink_input_assert_ref(i);
pa_assert_se(s = i->userdata);
- pa_hashmap_remove(s->userdata->by_origin, s->sdp_info.origin);
- session_free(s);
+ pa_hashmap_remove_and_free(s->userdata->by_origin, s->sdp_info.origin);
}
/* Called from IO context */
@@ -647,10 +646,7 @@ static void sap_event_cb(pa_mainloop_api *m, pa_io_event *e, int fd, pa_io_event
return;
if (goodbye) {
-
- if ((s = pa_hashmap_remove(u->by_origin, info.origin)))
- session_free(s);
-
+ pa_hashmap_remove_and_free(u->by_origin, info.origin);
pa_sdp_info_destroy(&info);
} else {
@@ -687,10 +683,8 @@ static void check_death_event_cb(pa_mainloop_api *m, pa_time_event *t, const str
k = pa_atomic_load(&s->timestamp);
- if (k + DEATH_TIMEOUT < now.tv_sec) {
- pa_hashmap_remove(u->by_origin, s->sdp_info.origin);
- session_free(s);
- }
+ if (k + DEATH_TIMEOUT < now.tv_sec)
+ pa_hashmap_remove_and_free(u->by_origin, s->sdp_info.origin);
}
/* Restart timer */