Changeset 4957:45ba4cf2abe3 in roaraudio
- Timestamp:
- 05/13/11 23:30:17 (13 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
libroar/config.c
r4784 r4957 335 335 336 336 if ( config->codecs.num == 0 ) { 337 config->codecs.codec = malloc(16*sizeof(struct roar_libroar_config_codec));337 config->codecs.codec = roar_mm_malloc(16*sizeof(struct roar_libroar_config_codec)); 338 338 } else { 339 config->codecs.codec = r ealloc(config->codecs.codec, (config->codecs.num+16)*sizeof(struct roar_libroar_config_codec));339 config->codecs.codec = roar_mm_realloc(config->codecs.codec, (config->codecs.num+16)*sizeof(struct roar_libroar_config_codec)); 340 340 } 341 341 -
libroar/meta.c
r4794 r4957 589 589 info->codec = -1; 590 590 591 if ( (lc = strdup(str)) == NULL )591 if ( (lc = roar_mm_strdup(str)) == NULL ) 592 592 return -1; 593 593 … … 625 625 } 626 626 627 free(lc);627 roar_mm_free(lc); 628 628 629 629 return 0; -
plugins/roard/protocol-esound.c
r4708 r4957 93 93 if ( cur->cmd == cmd ) { 94 94 if ( cur->datalen > 0 ) { 95 if ( (data = malloc(cur->datalen)) == NULL ) {95 if ( (data = roar_mm_malloc(cur->datalen)) == NULL ) { 96 96 // we will do a protocol error in case we do not drop the client 97 97 clients_delete(client); … … 103 103 104 104 if ( ret < 1 ) { 105 free(data);105 roar_mm_free(data); 106 106 clients_delete(client); 107 107 return -1; … … 123 123 124 124 if ( data != NULL ) 125 free(data);125 roar_mm_free(data); 126 126 127 127 return r; -
roard/codecfilter_alaw.c
r4923 r4957 74 74 len /= 2; 75 75 76 if ( (out = (char*) malloc(len)) == NULL )76 if ( (out = (char*)roar_mm_malloc(len)) == NULL ) 77 77 return -1; 78 78 … … 81 81 len = stream_vio_s_write(s, out, len); 82 82 83 free(out);83 roar_mm_free(out); 84 84 85 85 if ( len > 0 ) { -
roard/codecfilter_celt.c
r4708 r4957 34 34 struct roar_stream_server * info, 35 35 struct roar_codecfilter * filter) { 36 struct codecfilter_celt_inst * self = malloc(sizeof(struct codecfilter_celt_inst));36 struct codecfilter_celt_inst * self = roar_mm_malloc(sizeof(struct codecfilter_celt_inst)); 37 37 struct roar_stream * s = ROAR_STREAM(info); 38 38 … … 62 62 self->opened_decoder = 0; 63 63 self->s_buf = s->info.channels * self->frame_size * 2; 64 self->ibuf = malloc(self->s_buf);65 self->obuf = malloc(self->s_buf);66 self->i_rest = malloc(self->s_buf);67 self->o_rest = malloc(self->s_buf);64 self->ibuf = roar_mm_malloc(self->s_buf); 65 self->obuf = roar_mm_malloc(self->s_buf); 66 self->i_rest = roar_mm_malloc(self->s_buf); 67 self->o_rest = roar_mm_malloc(self->s_buf); 68 68 self->fi_rest = 0; 69 69 self->fo_rest = 0; 70 70 71 71 if ( !(self->ibuf && self->obuf && self->i_rest && self->o_rest) ) { 72 if ( self->ibuf )73 free(self->ibuf);74 75 if ( self->obuf )76 free(self->obuf);77 78 if ( self->i_rest )79 free(self->o_rest);80 81 if ( self->o_rest )82 free(self->o_rest);83 84 free(self);72 if ( self->ibuf != NULL ) 73 roar_mm_free(self->ibuf); 74 75 if ( self->obuf != NULL ) 76 roar_mm_free(self->obuf); 77 78 if ( self->i_rest != NULL ) 79 roar_mm_free(self->o_rest); 80 81 if ( self->o_rest != NULL ) 82 roar_mm_free(self->o_rest); 83 84 roar_mm_free(self); 85 85 return -1; 86 86 } … … 93 93 94 94 if ( !self->mode ) { 95 free(self);95 roar_mm_free(self); 96 96 return -1; 97 97 } … … 119 119 } else { 120 120 celt_mode_destroy(self->mode); 121 free(self);121 roar_mm_free(self); 122 122 return -1; 123 123 } … … 137 137 return -1; 138 138 139 if ( self->encoder )139 if ( self->encoder != NULL ) 140 140 celt_encoder_destroy(self->encoder); 141 141 142 if ( self->decoder )142 if ( self->decoder != NULL ) 143 143 celt_decoder_destroy(self->decoder); 144 144 145 if ( self->mode )145 if ( self->mode != NULL ) 146 146 celt_mode_destroy(self->mode); 147 147 148 if ( self->ibuf )149 free(self->ibuf);150 151 if ( self->obuf )152 free(self->obuf);153 154 if ( self->i_rest )155 free(self->i_rest);156 157 if ( self->o_rest )158 free(self->o_rest);159 160 free(inst);148 if ( self->ibuf != NULL ) 149 roar_mm_free(self->ibuf); 150 151 if ( self->obuf != NULL ) 152 roar_mm_free(self->obuf); 153 154 if ( self->i_rest != NULL ) 155 roar_mm_free(self->i_rest); 156 157 if ( self->o_rest != NULL ) 158 roar_mm_free(self->o_rest); 159 160 roar_mm_free(inst); 161 161 return 0; 162 162 } -
roard/codecfilter_fishsound.c
r4708 r4957 102 102 struct roar_stream_server * info, 103 103 struct roar_codecfilter * filter) { 104 struct codecfilter_fishsound_inst * self = malloc(sizeof(struct codecfilter_fishsound_inst));104 struct codecfilter_fishsound_inst * self = roar_mm_malloc(sizeof(struct codecfilter_fishsound_inst)); 105 105 struct roar_stream * s = ROAR_STREAM(info); 106 106 … … 109 109 110 110 if ( s->dir != ROAR_DIR_PLAY ) { 111 free(self);111 roar_mm_free(self); 112 112 return -1; 113 113 } … … 142 142 roar_buffer_free(self->buffer); 143 143 144 free(inst);144 roar_mm_free(inst); 145 145 return 0; 146 146 } -
roard/codecfilter_mulaw.c
r4923 r4957 74 74 len /= 2; 75 75 76 if ( (out = (char*) malloc(len)) == NULL )76 if ( (out = (char*)roar_mm_malloc(len)) == NULL ) 77 77 return -1; 78 78 … … 81 81 len = stream_vio_s_write(s, out, len); 82 82 83 free(out);83 roar_mm_free(out); 84 84 85 85 if ( len > 0 ) { -
roard/codecfilter_sndfile.c
r4708 r4957 33 33 struct codecfilter_sndfile_inst * obj; 34 34 35 if ( (obj = (struct codecfilter_sndfile_inst *) malloc(sizeof(struct codecfilter_sndfile_inst))) == NULL )35 if ( (obj = (struct codecfilter_sndfile_inst *) roar_mm_malloc(sizeof(struct codecfilter_sndfile_inst))) == NULL ) 36 36 return -1; 37 37 … … 60 60 sf_close(obj->state); 61 61 62 free(obj);62 roar_mm_free(obj); 63 63 64 64 return 0; -
roard/codecfilter_speex.c
r4708 r4957 46 46 struct roar_stream_server * info, 47 47 struct roar_codecfilter * filter) { 48 struct codecfilter_speex_inst * self = malloc(sizeof(struct codecfilter_speex_inst));48 struct codecfilter_speex_inst * self = roar_mm_malloc(sizeof(struct codecfilter_speex_inst)); 49 49 struct roar_stream * s = ROAR_STREAM(info); 50 50 … … 61 61 case 2: self->stereo = 1; break; 62 62 default: 63 free(self);63 roar_mm_free(self); 64 64 return -1; 65 65 } … … 111 111 speex_bits_destroy(&(self->bits)); 112 112 113 if ( self->cd )114 free(self->cd);115 116 if ( self->i_rest )117 free(self->i_rest);118 119 free((void*)self);113 if ( self->cd != NULL ) 114 roar_mm_free(self->cd); 115 116 if ( self->i_rest != NULL ) 117 roar_mm_free(self->i_rest); 118 119 roar_mm_free((void*)self); 120 120 121 121 return 0; … … 171 171 ROAR_DBG("cf_speex_read(*): frame_size=%i (%i bytes)", self->frame_size, fs2); 172 172 173 if ( !self->cd) {174 self->cd = malloc(fs2);175 if ( !self->cd)173 if ( self->cd == NULL ) { 174 self->cd = roar_mm_malloc(fs2); 175 if ( self->cd == NULL ) 176 176 return 0; 177 177 } 178 178 179 if ( !self->i_rest) {180 self->i_rest = malloc(fs2);181 if ( !self->i_rest)179 if ( self->i_rest == NULL ) { 180 self->i_rest = roar_mm_malloc(fs2); 181 if ( self->i_rest == NULL ) 182 182 return 0; 183 183 } … … 334 334 fs2 = self->frame_size * _FS; 335 335 336 if ( !self->cd) {337 self->cd = malloc(fs2 + 2);338 if ( !self->cd)336 if ( self->cd == NULL ) { 337 self->cd = roar_mm_malloc(fs2 + 2); 338 if ( self->cd == NULL ) 339 339 return 0; 340 340 } 341 341 342 if ( !self->o_rest) {343 self->o_rest = malloc(fs2);344 if ( !self->o_rest)342 if ( self->o_rest == NULL ) { 343 self->o_rest = roar_mm_malloc(fs2); 344 if ( self->o_rest == NULL ) 345 345 return 0; 346 346 } -
roard/container_framework.c
r4708 r4957 43 43 return -1; 44 44 45 if ( (self = malloc(sizeof(struct cont_fw_parent_inst))) == NULL ) {45 if ( (self = roar_mm_malloc(sizeof(struct cont_fw_parent_inst))) == NULL ) { 46 46 *inst = NULL; 47 47 return -1; … … 54 54 55 55 if ( cont_pvio_open(&(self->vio), self) == -1 ) { 56 free(self);56 roar_mm_free(self); 57 57 return -1; 58 58 } … … 85 85 inst->pcb.close(inst); 86 86 87 free(inst);87 roar_mm_free(inst); 88 88 89 89 ROAR_DBG("cont_fw_delete(inst=%p) = 0", inst); … … 135 135 return -1; 136 136 137 if ( (self = malloc(sizeof(struct cont_fw_child_vio_inst))) == NULL )137 if ( (self = roar_mm_malloc(sizeof(struct cont_fw_child_vio_inst))) == NULL ) 138 138 return -1; 139 139 … … 149 149 if ( inst->pcb.new_child(inst, self) == -1 ) { 150 150 inst->child[i] = NULL; 151 free(self);151 roar_mm_free(self); 152 152 return -1; 153 153 } … … 229 229 } 230 230 231 free(inst);231 roar_mm_free(inst); 232 232 233 233 return r; -
roard/driver_oss.c
r4846 r4957 345 345 } 346 346 347 #define er() close(self->fh); if ( self->device ) free(self->device);free(self); return -1347 #define er() close(self->fh); if ( self->device ) roar_mm_free(self->device); roar_mm_free(self); return -1 348 348 int driver_oss_open(struct roar_vio_calls * inst, char * device, struct roar_audio_info * info, int fh, struct roar_stream_server * sstream) { 349 349 struct driver_oss * self = NULL; 350 350 351 if ( (self = malloc(sizeof(struct driver_oss))) == NULL ) {352 ROAR_ERR("driver_oss_open(*): Can not malloc() instance data: %s", strerror(errno));351 if ( (self = roar_mm_malloc(sizeof(struct driver_oss))) == NULL ) { 352 ROAR_ERR("driver_oss_open(*): Can not roar_mm_malloc() instance data: %s", strerror(errno)); 353 353 return -1; 354 354 } … … 370 370 371 371 if ( device != NULL ) 372 self->device = strdup(device);372 self->device = roar_mm_strdup(device); 373 373 374 374 if ( driver_oss_init_vio(inst, self) == -1 ) { … … 419 419 420 420 if ( _get(vio,device) != NULL ) 421 free(_get(vio,device));422 423 free(vio->inst);421 roar_mm_free(_get(vio,device)); 422 423 roar_mm_free(vio->inst); 424 424 return 0; 425 425 } -
roard/driver_pwmled.c
r4708 r4957 30 30 int driver_pwmled_open_vio (struct roar_vio_calls * inst, char * device, struct roar_audio_info * info, int fh, struct roar_stream_server * sstream) { 31 31 struct roar_vio_defaults def; 32 struct driver_pwmled * self = malloc(sizeof(struct driver_pwmled));32 struct driver_pwmled * self = roar_mm_malloc(sizeof(struct driver_pwmled)); 33 33 34 34 if ( self == NULL ) … … 40 40 41 41 if ( roar_vio_dstr_init_defaults(&def, ROAR_VIO_DEF_TYPE_NONE, O_WRONLY, 0644) == -1 ) { 42 free(self);42 roar_mm_free(self); 43 43 return -1; 44 44 } 45 45 46 46 if ( roar_vio_open_dstr(&(self->vio), device, &def, 1) == -1 ) { 47 free(self);47 roar_mm_free(self); 48 48 return -1; 49 49 } … … 55 55 return -1; 56 56 */ 57 free(self);57 roar_mm_free(self); 58 58 return -1; 59 59 } … … 78 78 79 79 if ( roar_light_pwm_new(&(self->state), 16) == -1 ) { 80 free(self);80 roar_mm_free(self); 81 81 return -1; 82 82 } … … 92 92 93 93 if ( vio->inst != NULL ) 94 free(vio->inst);94 roar_mm_free(vio->inst); 95 95 96 96 return ret; -
roard/driver_sndio.c
r4708 r4957 52 52 struct driver_sndio * self = NULL; 53 53 54 if ( (self = malloc(sizeof(struct driver_sndio))) == NULL ) {55 ROAR_ERR("driver_sndio_open(*): Can not malloc() instance data: %s", strerror(errno));54 if ( (self = roar_mm_malloc(sizeof(struct driver_sndio))) == NULL ) { 55 ROAR_ERR("driver_sndio_open(*): Can not roar_mm_malloc() instance data: %s", strerror(errno)); 56 56 return -1; 57 57 } … … 85 85 86 86 if ( device != NULL ) 87 self->device = strdup(device);87 self->device = roar_mm_strdup(device); 88 88 89 89 if ( driver_sndio_init_vio(inst, self) == -1 ) { … … 113 113 114 114 if ( self->device != NULL ) 115 free(self->device);116 117 free(self);115 roar_mm_free(self->device); 116 117 roar_mm_free(self); 118 118 119 119 return 0; -
roard/driver_wmm.c
r4708 r4957 35 35 MMRESULT mmres; 36 36 37 self->bigbuffer = malloc(bytes);37 self->bigbuffer = roar_mm_malloc(bytes); 38 38 if (self->bigbuffer != NULL) { 39 39 int i; … … 60 60 &self->wh[i].wh,sizeof(WAVEHDR)); 61 61 } 62 free(self->bigbuffer);62 roar_mm_free(self->bigbuffer); 63 63 self->wh = 0; 64 64 self->spl = 0; … … 182 182 MMRESULT mmres; 183 183 184 if ( (self = malloc(sizeof(struct driver_wmm))) == NULL )184 if ( (self = roar_mm_malloc(sizeof(struct driver_wmm))) == NULL ) 185 185 return -1; 186 186 … … 252 252 } 253 253 254 free(self);254 roar_mm_free(self); 255 255 256 256 ROAR_DBG("driver_wmm_close_vio(*) = 0"); -
roard/light.c
r4708 r4957 37 37 return -1; 38 38 39 if ( (g_light_state.state = malloc(channels)) == NULL ) {40 return -1; 41 } 42 43 if ( (g_light_state.changes = malloc(channels)) == NULL ) {44 free(g_light_state.state);39 if ( (g_light_state.state = roar_mm_malloc(channels)) == NULL ) { 40 return -1; 41 } 42 43 if ( (g_light_state.changes = roar_mm_malloc(channels)) == NULL ) { 44 roar_mm_free(g_light_state.state); 45 45 return -1; 46 46 } … … 49 49 50 50 if ( (g_light_mixer.stream = add_mixer(ROAR_SUBSYS_LIGHT, _MIXER_NAME("Light Control"), &ss)) == -1 ) { 51 free(g_light_state.state);51 roar_mm_free(g_light_state.state); 52 52 return -1; 53 53 } … … 70 70 int light_free (void) { 71 71 if ( g_light_state.state != NULL ) { 72 free(g_light_state.state);72 roar_mm_free(g_light_state.state); 73 73 } 74 74 75 75 if ( g_light_state.changes != NULL ) { 76 free(g_light_state.changes);76 roar_mm_free(g_light_state.changes); 77 77 } 78 78 -
roard/sample.c
r4708 r4957 47 47 48 48 int samples_new (void) { 49 struct roar_sample * c = malloc(sizeof(struct roar_sample));49 struct roar_sample * c = roar_mm_malloc(sizeof(struct roar_sample)); 50 50 int i; 51 51 … … 63 63 } 64 64 65 free(c);65 roar_mm_free(c); 66 66 67 67 return -1; -
roard/streams.c
r4934 r4957 372 372 373 373 if ( s->output != NULL ) 374 free(s->output);374 roar_mm_free(s->output); 375 375 376 376 /* … … 386 386 387 387 if ( s->name != NULL ) 388 free(s->name);388 roar_mm_free(s->name); 389 389 390 390 roar_mm_free(s); … … 1336 1336 _CHECK_SID(id); 1337 1337 1338 if ( (str = strdup(name)) == NULL )1338 if ( (str = roar_mm_strdup(name)) == NULL ) 1339 1339 return -1; 1340 1340 1341 1341 if ( g_streams[id]->name != NULL ) 1342 free(g_streams[id]->name);1342 roar_mm_free(g_streams[id]->name); 1343 1343 1344 1344 g_streams[id]->name = str; … … 1722 1722 } 1723 1723 1724 if ( (g_streams[id]->output = malloc(size)) == NULL ) {1724 if ( (g_streams[id]->output = roar_mm_malloc(size)) == NULL ) { 1725 1725 ROAR_ERR("streams_get_outputbuffer(*): Can not alloc: %s", strerror(errno)); 1726 1726 return -1;
Note: See TracChangeset
for help on using the changeset viewer.