Changeset 3063:955233719a84 in roaraudio
- Timestamp:
- 12/26/09 20:36:31 (14 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
libroar/stack.c
r1284 r3063 48 48 49 49 struct roar_stack * roar_stack_newalloc(void) { 50 struct roar_stack * stack = malloc(sizeof(struct roar_stack));50 struct roar_stack * stack = roar_mm_malloc(sizeof(struct roar_stack)); 51 51 52 52 if ( stack == NULL ) -
libroar/vio_cmd.c
r1663 r3063 46 46 return -1; 47 47 48 if ( (state = malloc(sizeof(struct roar_vio_cmd_state))) == NULL )48 if ( (state = roar_mm_malloc(sizeof(struct roar_vio_cmd_state))) == NULL ) 49 49 return -1; 50 50 … … 132 132 133 133 // state->state = ROAR_VIO_CMD_STATE_CLOSED; 134 free(state);134 roar_mm_free(state); 135 135 136 136 return 0; … … 226 226 return -1; 227 227 228 if ( (state = malloc(sizeof(struct roar_vio_2popen_state))) == NULL )228 if ( (state = roar_mm_malloc(sizeof(struct roar_vio_2popen_state))) == NULL ) 229 229 return -1; 230 230 … … 282 282 free(state->child.cmd); 283 283 284 free(state);284 roar_mm_free(state); 285 285 286 286 return 0; -
libroar/vio_pipe.c
r1505 r3063 43 43 return -1; 44 44 45 if ( (self = malloc(sizeof(struct roar_vio_pipe))) == NULL )45 if ( (self = roar_mm_malloc(sizeof(struct roar_vio_pipe))) == NULL ) 46 46 return -1; 47 47 … … 65 65 // no buffers need to be set up here, 66 66 // we handle the NULL pointer in the reader and writer func 67 free(self);67 roar_mm_free(self); 68 68 return -1; 69 69 break; … … 73 73 if ( rw == O_RDWR || rw == O_RDONLY ) 74 74 if ( pipe(self->b.p) == -1 ) { 75 free(self);75 roar_mm_free(self); 76 76 return -1; 77 77 } … … 80 80 close(self->b.p[0]); 81 81 close(self->b.p[1]); 82 free(self);82 roar_mm_free(self); 83 83 return -1; 84 84 } … … 86 86 case ROAR_VIO_PIPE_TYPE_SOCKET: 87 87 if ( socketpair(AF_UNIX, SOCK_STREAM, 0, self->b.p) == -1 ) { 88 free(self);88 roar_mm_free(self); 89 89 return -1; 90 90 } … … 99 99 break; 100 100 default: 101 free(self);101 roar_mm_free(self); 102 102 return -1; 103 103 } … … 175 175 176 176 if ( ! self->refcount ) { 177 free(self);177 roar_mm_free(self); 178 178 } 179 179 -
libroar/vio_stack.c
r1505 r3063 41 41 return -1; 42 42 43 if ( (self = malloc(sizeof(struct roar_vio_stack))) == NULL )43 if ( (self = roar_mm_malloc(sizeof(struct roar_vio_stack))) == NULL ) 44 44 return -1; 45 45 … … 94 94 } 95 95 96 free(self);96 roar_mm_free(self); 97 97 98 98 return 0; -
libroardsp/convert.c
r2797 r3063 548 548 double radio = (double) to / (double) from; 549 549 int outsamples = radio * samples; 550 float * inf = malloc(samples*sizeof(float));551 float * outf = malloc(outsamples*sizeof(float));550 float * inf = roar_mm_malloc(samples*sizeof(float)); 551 float * outf = roar_mm_malloc(outsamples*sizeof(float)); 552 552 int i; 553 553 SRC_DATA srcdata; … … 557 557 if ( inf == NULL ) { 558 558 if ( outf != NULL ) 559 free(outf);559 roar_mm_free(outf); 560 560 561 561 return -1; … … 564 564 if ( outf == NULL ) { 565 565 if ( inf != NULL ) 566 free(inf);566 roar_mm_free(inf); 567 567 568 568 return -1; … … 583 583 break; 584 584 default: 585 free(outf);586 free(inf);585 roar_mm_free(outf); 586 roar_mm_free(inf); 587 587 return -1; 588 588 } … … 595 595 596 596 if ( src_simple(&srcdata, SRC_ZERO_ORDER_HOLD, channels) != 0 ) { 597 free(outf);598 free(inf);597 roar_mm_free(outf); 598 roar_mm_free(inf); 599 599 return -1; 600 600 } … … 616 616 } 617 617 618 free(outf);619 free(inf);618 roar_mm_free(outf); 619 roar_mm_free(inf); 620 620 621 621 return 0; … … 883 883 real_out = out; 884 884 885 if ( (out = malloc(from_size)) == NULL )886 return -1; 887 888 ROAR_DBG("roar_conv(*): malloc(%i)=%p", (int)from_size, out);885 if ( (out = roar_mm_malloc(from_size)) == NULL ) 886 return -1; 887 888 ROAR_DBG("roar_conv(*): roar_mm_malloc(%i)=%p", (int)from_size, out); 889 889 } 890 890 … … 895 895 if ( roar_conv_endian(out, ip, samples, ROAR_CODEC_BYTE_ORDER(from->codec), ROAR_CODEC_NATIVE_ENDIAN, from->bits) == -1 ) { 896 896 if ( to_size < from_size ) 897 free(out);897 roar_mm_free(out); 898 898 return -1; 899 899 } else { … … 905 905 if ( roar_conv_bits(out, ip, samples, from->bits, to->bits) == -1 ) { 906 906 if ( to_size < from_size ) 907 free(out);907 roar_mm_free(out); 908 908 return -1; 909 909 } else { … … 915 915 if ( roar_conv_signedness(out, ip, samples, ROAR_CODEC_IS_SIGNED(from->codec), ROAR_CODEC_IS_SIGNED(to->codec), to->bits) == -1 ) { 916 916 if ( to_size < from_size ) 917 free(out);917 roar_mm_free(out); 918 918 return -1; 919 919 } else { … … 935 935 ROAR_DBG("roar_conv(*): failed to convert rate %i->%i (%ich%ibits)", from->rate, to->rate, to->bits, from->channels); 936 936 if ( to_size < from_size ) 937 free(out);937 roar_mm_free(out); 938 938 return -1; 939 939 } else { … … 946 946 if ( roar_conv_chans(out, ip, samples, from->channels, to->channels, to->bits) == -1 ) { 947 947 if ( to_size < from_size ) 948 free(out);948 roar_mm_free(out); 949 949 return -1; 950 950 } else { … … 956 956 if ( roar_conv_endian(out, ip, samples, ROAR_CODEC_NATIVE_ENDIAN, ROAR_CODEC_BYTE_ORDER(to->codec), to->bits) == -1 ) { 957 957 if ( to_size < from_size ) 958 free(out);958 roar_mm_free(out); 959 959 return -1; 960 960 } else { … … 966 966 ROAR_DBG("roar_conv(*): memcpy(%p, %p, %i) = ?", real_out, out, (int)to_size); 967 967 memcpy(real_out, out, to_size); 968 free(out);968 roar_mm_free(out); 969 969 ROAR_DBG("roar_conv(*): free(%p): OK!", out); 970 970 } -
libroardsp/transcode_celt.c
r2204 r3063 31 31 32 32 int roar_xcoder_celt_init (struct roar_xcoder * state) { 33 struct roar_xcoder_celt * self = malloc(sizeof(struct roar_xcoder_celt));33 struct roar_xcoder_celt * self = roar_mm_malloc(sizeof(struct roar_xcoder_celt)); 34 34 struct roar_audio_info * info = &(state->info.pcm); 35 35 … … 39 39 // curruntly only 16 bit mode is supported 40 40 if ( info->bits != 16 ) { 41 free(self);41 roar_mm_free(self); 42 42 return -1; 43 43 } … … 50 50 51 51 self->bufferlen = info->channels * 32 + _SIZE_LEN; 52 self->iobuffer = malloc(self->bufferlen);52 self->iobuffer = roar_mm_malloc(self->bufferlen); 53 53 54 54 if ( self->iobuffer == NULL ) { 55 free(self);55 roar_mm_free(self); 56 56 return -1; 57 57 } … … 60 60 61 61 if ( self->mode == NULL ) { 62 free(self); 62 roar_mm_free(self->iobuffer); 63 roar_mm_free(self); 63 64 return -1; 64 65 } … … 87 88 88 89 if ( self->iobuffer ) 89 free(self->iobuffer);90 roar_mm_free(self->iobuffer); 90 91 91 92 if ( self->encoder ) … … 98 99 celt_mode_destroy(self->mode); 99 100 100 free(self);101 roar_mm_free(self); 101 102 102 103 ROAR_DBG("roar_xcoder_celt_uninit(*) = 0"); -
libroardsp/transcode_speex.c
r2974 r3063 33 33 34 34 int roar_xcoder_speex_init (struct roar_xcoder * state) { 35 struct roar_xcoder_speex * self = malloc(sizeof(struct roar_xcoder_speex));35 struct roar_xcoder_speex * self = roar_mm_malloc(sizeof(struct roar_xcoder_speex)); 36 36 struct roar_audio_info * info = &(state->info.pcm); 37 37 int tmp; … … 44 44 // curruntly only 16 bit mode is supported 45 45 if ( info->bits != 16 ) { 46 free(self);46 roar_mm_free(self); 47 47 return -1; 48 48 } … … 53 53 case 2: self->stereo = 1; break; 54 54 default: 55 free(self);55 roar_mm_free(self); 56 56 return -1; 57 57 } … … 140 140 speex_bits_destroy(&(self->bits)); 141 141 142 free(self);142 roar_mm_free(self); 143 143 144 144 return 0; -
libroardsp/vio_transcode.c
r2644 r3063 27 27 int roar_vio_open_xcode (struct roar_vio_calls * calls, int encoder, struct roar_audio_info * info, 28 28 struct roar_vio_calls * dst) { 29 struct roar_xcoder * xcoder = malloc(sizeof(struct roar_xcoder));29 struct roar_xcoder * xcoder = roar_mm_malloc(sizeof(struct roar_xcoder)); 30 30 31 31 if ( xcoder == NULL ) … … 33 33 34 34 if ( calls == NULL || info == NULL || dst == NULL ) { 35 free(xcoder);35 roar_mm_free(xcoder); 36 36 return -1; 37 37 } 38 38 39 39 if ( roar_xcoder_init(xcoder, encoder, info, dst) == -1 ) { 40 free(xcoder);40 roar_mm_free(xcoder); 41 41 return -1; 42 42 } … … 94 94 95 95 if ( vio->inst != NULL ) 96 free(vio->inst);96 roar_mm_free(vio->inst); 97 97 98 98 return ret; … … 101 101 int roar_vio_open_bixcode (struct roar_vio_calls * calls, struct roar_audio_info * info, 102 102 struct roar_vio_calls * dst) { 103 struct roar_bixcoder * bixcoder = malloc(sizeof(struct roar_bixcoder));103 struct roar_bixcoder * bixcoder = roar_mm_malloc(sizeof(struct roar_bixcoder)); 104 104 105 105 if ( bixcoder == NULL ) … … 107 107 108 108 if ( calls == NULL || info == NULL || dst == NULL ) { 109 free(bixcoder);109 roar_mm_free(bixcoder); 110 110 return -1; 111 111 } 112 112 113 113 if ( roar_bixcoder_init(bixcoder, info, dst) == -1 ) { 114 free(bixcoder);114 roar_mm_free(bixcoder); 115 115 return -1; 116 116 } … … 165 165 166 166 if ( vio->inst != NULL ) 167 free(vio->inst);167 roar_mm_free(vio->inst); 168 168 169 169 return ret; -
roard/clients.c
r2828 r3063 51 51 for (i = 0; i < ROAR_CLIENTS_MAX; i++) { 52 52 if ( g_clients[i] == NULL ) { 53 n = malloc(sizeof(struct roar_client));53 n = roar_mm_malloc(sizeof(struct roar_client)); 54 54 if ( n != NULL ) { 55 55 n->pid = -1; … … 71 71 72 72 if ( roar_nnode_new(&(n->nnode), ROAR_SOCKET_TYPE_UNKNOWN) == -1 ) { 73 free(n);73 roar_mm_free(n); 74 74 return -1; 75 75 } … … 114 114 roar_nnode_free(&(g_clients[id]->nnode)); 115 115 116 free(g_clients[id]);116 roar_mm_free(g_clients[id]); 117 117 g_clients[id] = NULL; 118 118 -
roard/streams.c
r3042 r3063 68 68 for (i = 0; i < ROAR_STREAMS_MAX; i++) { 69 69 if ( g_streams[i] == NULL ) { 70 s = ROAR_STREAM_SERVER(n = ROAR_STREAM( malloc(sizeof(struct roar_stream_server))));70 s = ROAR_STREAM_SERVER(n = ROAR_STREAM(roar_mm_malloc(sizeof(struct roar_stream_server)))); 71 71 if ( n == NULL ) { 72 72 ROAR_ERR("streams_new(void): can not allocate memory for new stream: %s", strerror(errno)); … … 252 252 free(s->name); 253 253 254 free(s);254 roar_mm_free(s); 255 255 256 256 g_streams[id] = NULL;
Note: See TracChangeset
for help on using the changeset viewer.