summaryrefslogtreecommitdiffstats
path: root/polyp/alsa-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2004-08-04 16:39:30 +0000
committerLennart Poettering <lennart@poettering.net>2004-08-04 16:39:30 +0000
commit46091a9237f17f4295dca7140d8d70b4fce8b357 (patch)
tree1c600cd6e1801586abfb66d767f2cd96e15c819c /polyp/alsa-util.c
parent24291aff27c671c11619684cb10d3b36fdf87c0d (diff)
introduce pa_xmalloc() and friends
implement module auto loading git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@103 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'polyp/alsa-util.c')
-rw-r--r--polyp/alsa-util.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/polyp/alsa-util.c b/polyp/alsa-util.c
index 7f266df5..43562378 100644
--- a/polyp/alsa-util.c
+++ b/polyp/alsa-util.c
@@ -27,6 +27,7 @@
#include "alsa-util.h"
#include "sample.h"
+#include "xmalloc.h"
int pa_alsa_set_hw_params(snd_pcm_t *pcm_handle, struct pa_sample_spec *ss, uint32_t *periods, snd_pcm_uframes_t *buffer_size) {
int ret = 0;
@@ -66,15 +67,13 @@ int pa_create_io_sources(snd_pcm_t *pcm_handle, struct pa_mainloop_api* m, void
*n_io_sources = snd_pcm_poll_descriptors_count(pcm_handle);
- pfds = malloc(sizeof(struct pollfd) * *n_io_sources);
- assert(pfds);
+ pfds = pa_xmalloc(sizeof(struct pollfd) * *n_io_sources);
if (snd_pcm_poll_descriptors(pcm_handle, pfds, *n_io_sources) < 0) {
- free(pfds);
+ pa_xfree(pfds);
return -1;
}
- *io_sources = malloc(sizeof(void*) * *n_io_sources);
- assert(io_sources);
+ *io_sources = pa_xmalloc(sizeof(void*) * *n_io_sources);
for (i = 0, ios = *io_sources, ppfd = pfds; i < *n_io_sources; i++, ios++, ppfd++) {
*ios = m->source_io(m, ppfd->fd,
@@ -83,7 +82,7 @@ int pa_create_io_sources(snd_pcm_t *pcm_handle, struct pa_mainloop_api* m, void
assert(*ios);
}
- free(pfds);
+ pa_xfree(pfds);
return 0;
}
@@ -94,5 +93,5 @@ void pa_free_io_sources(struct pa_mainloop_api* m, void **io_sources, unsigned n
for (ios = io_sources, i = 0; i < n_io_sources; i++, ios++)
m->cancel_io(m, *ios);
- free(io_sources);
+ pa_xfree(io_sources);
}