summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Henningsson <david.henningsson@canonical.com>2012-02-15 16:51:31 +0100
committerArun Raghavan <arun.raghavan@collabora.co.uk>2012-02-19 22:45:41 +0530
commit13a84d0747c9fe114850477460f2ac68cba0c4b6 (patch)
treeabe500967b0dfb226b7e33f0aea8f7096f020586 /src
parente91e78bb54456eda7f815afdb25857fe0887de22 (diff)
alsa-mixer: Don't use dangling pointers as port hashmap keys
If alsa settings/options were used, the string to construct the name was freed, leading to dangling pointers to strings inside the hashmap. BugLink: https://bugs.launchpad.net/bugs/932804 Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Diffstat (limited to 'src')
-rw-r--r--src/modules/alsa/alsa-mixer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 9bf80695..7e6ef542 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -4397,7 +4397,7 @@ static pa_device_port* device_port_alsa_init(pa_hashmap *ports,
p = pa_device_port_new(core, name, description, sizeof(pa_alsa_port_data));
pa_assert(p);
- pa_hashmap_put(ports, name, p);
+ pa_hashmap_put(ports, p->name, p);
p->profiles = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
data = PA_DEVICE_PORT_DATA(p);
@@ -4412,7 +4412,7 @@ static pa_device_port* device_port_alsa_init(pa_hashmap *ports,
pa_hashmap_put(p->profiles, cp->name, cp);
if (extra) {
- pa_hashmap_put(extra, name, p);
+ pa_hashmap_put(extra, p->name, p);
pa_device_port_ref(p);
}