static int unsuspend(struct userdata *u) {
pa_sample_spec sample_spec;
int32_t ret;
+ size_t frame_size;
+
pa_assert(u);
pa_assert(!u->pcm_handle);
pa_log_info("Trying resume...");
+
sample_spec = u->sink->sample_spec;
+ frame_size = pa_frame_size(&sample_spec);
+ if (frame_size == 0) {
+ pa_log_error("Unexpected frame size zero!");
+ goto fail;
+ }
+
ret = pa_hal_interface_pcm_open(u->hal_interface,
(void **)&u->pcm_handle,
DIRECTION_OUT,
&sample_spec,
- u->frag_size / pa_frame_size(&sample_spec),
+ u->frag_size / frame_size,
u->nfrags);
if (ret) {
pa_log_error("Error opening PCM device %x", ret);
while (u->timestamp < now + u->block_usec) {
pa_memchunk chunk;
frame_size = pa_frame_size(&u->sink->sample_spec);
+ if (frame_size == 0) {
+ pa_log_error("Unexpected frame size zero!");
+ break;
+ }
pa_hal_interface_pcm_available(u->hal_interface, u->pcm_handle, &avail);
if ((avail == 0) && !(u->first)) {
}
static int init_stream_map(pa_stream_manager *m) {
- volume_info *v;
- stream_info *s;
- latency_info *l;
+ volume_info *v = NULL;
+ stream_info *s = NULL;
+ latency_info *l = NULL;
json_object *o;
json_object *array_o;
json_object *array_item_o;
goto fail;
}
pa_hashmap_put(m->latency_infos, (void*)type, l);
+ l = NULL;
}
}
}
goto fail;
}
pa_hashmap_put(m->volume_infos, (void*)type, v);
+ v = NULL;
}
}
}
goto fail;
}
pa_hashmap_put(m->stream_infos, (void*)role, s);
+ s = NULL;
}
}
} else {
fail:
pa_log_error("failed to initialize stream-map");
+ pa_xfree(v);
+ pa_xfree(s);
+ pa_xfree(l);
+
if (m->stream_infos)
pa_hashmap_free(m->stream_infos);
if (m->volume_infos)