summaryrefslogtreecommitdiff
path: root/src/sink.c
diff options
context:
space:
mode:
authorben <benjaminfranzke@googlemail.com>2010-07-13 00:24:21 +0200
committerben <benjaminfranzke@googlemail.com>2010-07-13 00:24:21 +0200
commitf2b8a7000aef9b7eecc0396d9bbe0ccfee9b8100 (patch)
treeb9fac9471524c828ee0816348c3c38922bd3eacc /src/sink.c
parent6c2431b9f428d21b5219be97d07c7ce580a30983 (diff)
downloadpa-sink-ctl-f2b8a7000aef9b7eecc0396d9bbe0ccfee9b8100.tar.gz
pa-sink-ctl-f2b8a7000aef9b7eecc0396d9bbe0ccfee9b8100.tar.bz2
pa-sink-ctl-f2b8a7000aef9b7eecc0396d9bbe0ccfee9b8100.zip
fix reallocs that saved pointer only in local vars
Diffstat (limited to 'src/sink.c')
-rw-r--r--src/sink.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/sink.c b/src/sink.c
index 38f061b..3622f74 100644
--- a/src/sink.c
+++ b/src/sink.c
@@ -50,21 +50,23 @@ void sink_check(sink_info** sink) {
/*
* check the list length and resize the list, if current position = max
*/
-void sink_list_check(sink_info** sink_list, uint32_t* max, uint32_t counter) {
+void sink_list_check(sink_info*** sink_list, uint32_t* max, uint32_t counter) {
+ if (counter < *max)
+ return;
- if (counter >= (*max)) {
- (*max) *= 2;
- sink_list = (sink_info**) realloc(sink_list, (*max) * sizeof(sink_info*));
+ *max *= 2;
+ *sink_list = (sink_info**) realloc(*sink_list, (*max) * sizeof(sink_info*));
+
+
+ for (int i = counter; i < *max; ++i)
+ (*sink_list)[i] = NULL;
- for (int i = counter; i < (*max); ++i)
- sink_list[i] = NULL;
- }
}
void sink_check_input_list(sink_info* sink) {
if (sink->input_counter >= sink->input_max)
- sink_input_list_enlarge(sink->input_list, &sink->input_max, sink->input_counter);
+ sink_input_list_enlarge(&sink->input_list, &sink->input_max, sink->input_counter);
}
sink_info** sink_list_init(uint32_t max) {