Changeset 37a2578ce4265f4ed495290923e3fa674c662656
- Timestamp:
- 22/06/08 22:05:09
(5 months ago)
- Author:
- Rémi Duraffort <ivoire@videolan.org>
- git-committer:
- Rémi Duraffort <ivoire@videolan.org> 1214165109 +0200
- git-parent:
[172e22c2f2b4abbdfee50d9fe8aaaede4b405c76]
- git-author:
- Rémi Duraffort <ivoire@videolan.org> 1214165109 +0200
- Message:
Remove unneeded msg_Err.
Fix potential segfault (check malloc return value).
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r3561b9b |
r37a2578 |
|
| 314 | 314 | p_aout->output.p_sys = p_sys = malloc( sizeof( aout_sys_t ) ); |
|---|
| 315 | 315 | if( p_sys == NULL ) |
|---|
| 316 | | { |
|---|
| 317 | | msg_Err( p_aout, "out of memory" ); |
|---|
| 318 | 316 | return VLC_ENOMEM; |
|---|
| 319 | | } |
|---|
| 320 | 317 | p_sys->b_playing = false; |
|---|
| 321 | 318 | p_sys->start_date = 0; |
|---|
| r3561b9b |
r37a2578 |
|
| 84 | 84 | p_sys = malloc( sizeof( aout_sys_t ) ); |
|---|
| 85 | 85 | if( p_sys == NULL ) |
|---|
| 86 | | { |
|---|
| 87 | | msg_Err( p_aout, "out of memory" ); |
|---|
| 88 | 86 | return VLC_ENOMEM; |
|---|
| 89 | | } |
|---|
| 90 | 87 | p_aout->output.p_sys = p_sys; |
|---|
| 91 | 88 | |
|---|
| r3561b9b |
r37a2578 |
|
| 162 | 162 | p_aout->output.p_sys = malloc( sizeof( aout_sys_t ) ); |
|---|
| 163 | 163 | if( p_aout->output.p_sys == NULL ) |
|---|
| 164 | | { |
|---|
| 165 | | msg_Err( p_aout, "out of memory" ); |
|---|
| 166 | | return( VLC_ENOMEM ); |
|---|
| 167 | | } |
|---|
| | 164 | return VLC_ENOMEM; |
|---|
| 168 | 165 | |
|---|
| 169 | 166 | p_sys = p_aout->output.p_sys; |
|---|
| … | … | |
| 650 | 647 | p_streams = (AudioStreamID *)malloc( i_param_size ); |
|---|
| 651 | 648 | if( p_streams == NULL ) |
|---|
| 652 | | { |
|---|
| 653 | | msg_Err( p_aout, "out of memory" ); |
|---|
| 654 | | return false; |
|---|
| 655 | | } |
|---|
| | 649 | return false; |
|---|
| 656 | 650 | |
|---|
| 657 | 651 | err = AudioDeviceGetProperty( p_sys->i_selected_dev, 0, FALSE, |
|---|
| … | … | |
| 686 | 680 | p_format_list = (AudioStreamBasicDescription *)malloc( i_param_size ); |
|---|
| 687 | 681 | if( p_format_list == NULL ) |
|---|
| 688 | | { |
|---|
| 689 | | msg_Err( p_aout, "could not malloc the memory" ); |
|---|
| 690 | 682 | continue; |
|---|
| 691 | | } |
|---|
| 692 | 683 | |
|---|
| 693 | 684 | err = AudioStreamGetProperty( p_streams[i], 0, |
|---|
| … | … | |
| 952 | 943 | p_devices = (AudioDeviceID*)malloc( sizeof(AudioDeviceID) * p_sys->i_devices ); |
|---|
| 953 | 944 | if( p_devices == NULL ) |
|---|
| 954 | | { |
|---|
| 955 | | msg_Err( p_aout, "out of memory" ); |
|---|
| 956 | 945 | goto error; |
|---|
| 957 | | } |
|---|
| 958 | 946 | |
|---|
| 959 | 947 | /* Populate DeviceID array */ |
|---|
| … | … | |
| 1102 | 1090 | p_streams = (AudioStreamID *)malloc( i_param_size ); |
|---|
| 1103 | 1091 | if( p_streams == NULL ) |
|---|
| 1104 | | { |
|---|
| 1105 | | msg_Err( p_aout, "out of memory" ); |
|---|
| 1106 | 1092 | return VLC_ENOMEM; |
|---|
| 1107 | | } |
|---|
| 1108 | 1093 | |
|---|
| 1109 | 1094 | err = AudioDeviceGetProperty( i_dev_id, 0, FALSE, |
|---|
| … | … | |
| 1151 | 1136 | p_format_list = (AudioStreamBasicDescription *)malloc( i_param_size ); |
|---|
| 1152 | 1137 | if( p_format_list == NULL ) |
|---|
| 1153 | | { |
|---|
| 1154 | | msg_Err( p_aout, "could not malloc the memory" ); |
|---|
| 1155 | | return false; |
|---|
| 1156 | | } |
|---|
| | 1138 | return false; |
|---|
| 1157 | 1139 | |
|---|
| 1158 | 1140 | err = AudioStreamGetProperty( i_stream_id, 0, |
|---|
| r3561b9b |
r37a2578 |
|
| 255 | 255 | p_aout->output.p_sys = malloc( sizeof( aout_sys_t ) ); |
|---|
| 256 | 256 | if( p_aout->output.p_sys == NULL ) |
|---|
| 257 | | { |
|---|
| 258 | | msg_Err( p_aout, "out of memory" ); |
|---|
| 259 | 257 | return VLC_ENOMEM; |
|---|
| 260 | | } |
|---|
| 261 | 258 | |
|---|
| 262 | 259 | /* Initialize some variables */ |
|---|
| r3561b9b |
r37a2578 |
|
| 92 | 92 | p_sys = malloc( sizeof( aout_sys_t ) ); |
|---|
| 93 | 93 | if( p_sys == NULL ) |
|---|
| 94 | | { |
|---|
| 95 | | msg_Err( p_aout, "out of memory" ); |
|---|
| 96 | 94 | return VLC_ENOMEM; |
|---|
| 97 | | } |
|---|
| 98 | 95 | |
|---|
| 99 | 96 | p_aout->output.p_sys = p_sys; |
|---|
| r3561b9b |
r37a2578 |
|
| 155 | 155 | p_aout->output.p_sys = malloc( sizeof( aout_sys_t ) ); |
|---|
| 156 | 156 | if( p_aout->output.p_sys == NULL ) |
|---|
| 157 | | { |
|---|
| 158 | | msg_Err( p_aout, "out of memory" ); |
|---|
| 159 | | return VLC_EGENERIC; |
|---|
| 160 | | } |
|---|
| | 157 | return VLC_ENOMEM; |
|---|
| 161 | 158 | |
|---|
| 162 | 159 | if( !strcmp( psz_name, "-" ) ) |
|---|
| r3561b9b |
r37a2578 |
|
| 98 | 98 | (aout_sys_t *)malloc( sizeof( aout_sys_t ) ); |
|---|
| 99 | 99 | if( p_aout->output.p_sys == NULL ) |
|---|
| 100 | | { |
|---|
| 101 | | msg_Err( p_aout, "out of memory" ); |
|---|
| 102 | | return VLC_EGENERIC; |
|---|
| 103 | | } |
|---|
| | 100 | return VLC_ENOMEM; |
|---|
| 104 | 101 | |
|---|
| 105 | 102 | /* New PCMAudioPlayer */ |
|---|
| … | … | |
| 107 | 104 | if( p_sys->pPlayer == NULL ) |
|---|
| 108 | 105 | { |
|---|
| 109 | | msg_Err( p_aout, "out of memory" ); |
|---|
| 110 | | free( p_sys ); |
|---|
| 111 | | return VLC_EGENERIC; |
|---|
| | 106 | free( p_sys ); |
|---|
| | 107 | return VLC_ENOMEM; |
|---|
| 112 | 108 | } |
|---|
| 113 | 109 | |
|---|
| … | … | |
| 128 | 124 | if( p_sys->ppBuffers == NULL ) |
|---|
| 129 | 125 | { |
|---|
| 130 | | msg_Err( p_aout, "out of memory" ); |
|---|
| 131 | | delete pPlayer; |
|---|
| 132 | | free( p_sys ); |
|---|
| 133 | | return VLC_EGENERIC; |
|---|
| | 126 | delete pPlayer; |
|---|
| | 127 | free( p_sys ); |
|---|
| | 128 | return VLC_ENOMEM; |
|---|
| 134 | 129 | } |
|---|
| 135 | 130 | |
|---|
| r3561b9b |
r37a2578 |
|
| 109 | 109 | if( p_sys == NULL ) |
|---|
| 110 | 110 | { |
|---|
| 111 | | msg_Err( p_aout, "out of memory" ); |
|---|
| 112 | 111 | status = VLC_ENOMEM; |
|---|
| 113 | 112 | goto error_out; |
|---|
| … | … | |
| 144 | 143 | if( p_sys->p_jack_ports == NULL ) |
|---|
| 145 | 144 | { |
|---|
| 146 | | msg_Err( p_aout, "out of memory" ); |
|---|
| 147 | 145 | status = VLC_ENOMEM; |
|---|
| 148 | 146 | goto error_out; |
|---|
| … | … | |
| 153 | 151 | if( p_sys->p_jack_buffers == NULL ) |
|---|
| 154 | 152 | { |
|---|
| 155 | | msg_Err( p_aout, "out of memory" ); |
|---|
| 156 | 153 | status = VLC_ENOMEM; |
|---|
| 157 | 154 | goto error_out; |
|---|
| r3561b9b |
r37a2578 |
|
| 280 | 280 | p_aout->output.p_sys = p_sys = malloc( sizeof( aout_sys_t ) ); |
|---|
| 281 | 281 | if( p_sys == NULL ) |
|---|
| 282 | | { |
|---|
| 283 | | msg_Err( p_aout, "out of memory" ); |
|---|
| 284 | 282 | return VLC_ENOMEM; |
|---|
| 285 | | } |
|---|
| 286 | 283 | |
|---|
| 287 | 284 | /* Get device name */ |
|---|
| r3561b9b |
r37a2578 |
|
| 182 | 182 | p_sys = (aout_sys_t *)malloc( sizeof(aout_sys_t) ); |
|---|
| 183 | 183 | if( p_sys == NULL ) |
|---|
| 184 | | { |
|---|
| 185 | | msg_Err( p_aout, "out of memory" ); |
|---|
| 186 | 184 | return VLC_ENOMEM; |
|---|
| 187 | | } |
|---|
| 188 | 185 | p_sys->p_aout = p_aout; |
|---|
| 189 | 186 | p_sys->p_stream = 0; |
|---|
| r3561b9b |
r37a2578 |
|
| 246 | 246 | |
|---|
| 247 | 247 | if( p_aout->output.p_sys == NULL ) |
|---|
| 248 | | { |
|---|
| 249 | | msg_Err( p_aout, "out of memory" ); |
|---|
| 250 | | return VLC_EGENERIC; |
|---|
| 251 | | } |
|---|
| | 248 | return VLC_ENOMEM; |
|---|
| 252 | 249 | |
|---|
| 253 | 250 | p_aout->output.pf_play = Play; |
|---|
| … | … | |
| 412 | 409 | { |
|---|
| 413 | 410 | free( p_aout->output.p_sys ); |
|---|
| 414 | | msg_Err( p_aout, "out of memory" ); |
|---|
| 415 | 411 | return 1; |
|---|
| 416 | 412 | } |
|---|
| rf7d5f3e |
r37a2578 |
|
| 101 | 101 | (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL ) |
|---|
| 102 | 102 | { |
|---|
| 103 | | msg_Err( p_dec, "out of memory" ); |
|---|
| 104 | 103 | return VLC_ENOMEM; |
|---|
| 105 | 104 | } |
|---|
| … | … | |
| 140 | 139 | malloc( p_sys->p_context->extradata_size + |
|---|
| 141 | 140 | FF_INPUT_BUFFER_PADDING_SIZE ); |
|---|
| 142 | | memcpy( p_sys->p_context->extradata, |
|---|
| 143 | | (char*)p_dec->fmt_in.p_extra + i_offset, |
|---|
| 144 | | p_sys->p_context->extradata_size ); |
|---|
| 145 | | memset( (char*)p_sys->p_context->extradata + |
|---|
| 146 | | p_sys->p_context->extradata_size, 0, |
|---|
| 147 | | FF_INPUT_BUFFER_PADDING_SIZE ); |
|---|
| | 141 | if( p_sys->p_context->extradata ) |
|---|
| | 142 | { |
|---|
| | 143 | memcpy( p_sys->p_context->extradata, |
|---|
| | 144 | (char*)p_dec->fmt_in.p_extra + i_offset, |
|---|
| | 145 | p_sys->p_context->extradata_size ); |
|---|
| | 146 | memset( (char*)p_sys->p_context->extradata + |
|---|
| | 147 | p_sys->p_context->extradata_size, 0, |
|---|
| | 148 | FF_INPUT_BUFFER_PADDING_SIZE ); |
|---|
| | 149 | } |
|---|
| 148 | 150 | } |
|---|
| 149 | 151 | else |
|---|
| rf7d5f3e |
r37a2578 |
|
| 85 | 85 | (filter_sys_t *)malloc(sizeof(filter_sys_t)) ) == NULL ) |
|---|
| 86 | 86 | { |
|---|
| 87 | | msg_Err( p_filter, "out of memory" ); |
|---|
| 88 | 87 | return VLC_EGENERIC; |
|---|
| 89 | 88 | } |
|---|
| r2aa6ed9 |
r37a2578 |
|
| 254 | 254 | /* Allocate the memory needed to store the encoder's structure */ |
|---|
| 255 | 255 | if( ( p_sys = (encoder_sys_t *)malloc(sizeof(encoder_sys_t)) ) == NULL ) |
|---|
| 256 | | { |
|---|
| 257 | | msg_Err( p_enc, "out of memory" ); |
|---|
| 258 | | return VLC_EGENERIC; |
|---|
| 259 | | } |
|---|
| | 256 | return VLC_ENOMEM; |
|---|
| 260 | 257 | memset( p_sys, 0, sizeof(encoder_sys_t) ); |
|---|
| 261 | 258 | p_enc->p_sys = p_sys; |
|---|
| re384ccd |
r37a2578 |
|
| 233 | 233 | (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL ) |
|---|
| 234 | 234 | { |
|---|
| 235 | | msg_Err( p_dec, "out of memory" ); |
|---|
| 236 | 235 | return VLC_ENOMEM; |
|---|
| 237 | 236 | } |
|---|
| r3561b9b |
r37a2578 |
|
| 109 | 109 | (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL ) |
|---|
| 110 | 110 | { |
|---|
| 111 | | msg_Err( p_dec, "out of memory" ); |
|---|
| 112 | 111 | return VLC_EGENERIC; |
|---|
| 113 | 112 | } |
|---|
| r3561b9b |
r37a2578 |
|
| 521 | 521 | (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL ) |
|---|
| 522 | 522 | { |
|---|
| 523 | | msg_Err( p_dec, "out of memory" ); |
|---|
| 524 | 523 | goto error; |
|---|
| 525 | 524 | } |
|---|
| … | … | |
| 1342 | 1341 | (encoder_sys_t *)malloc(sizeof(encoder_sys_t)) ) == NULL ) |
|---|
| 1343 | 1342 | { |
|---|
| 1344 | | msg_Err( p_enc, "out of memory" ); |
|---|
| 1345 | 1343 | goto error; |
|---|
| 1346 | 1344 | } |
|---|
| r3561b9b |
r37a2578 |
|
| 1665 | 1665 | /* Allocate the memory needed to store the decoder's structure */ |
|---|
| 1666 | 1666 | if( ( p_sys = (encoder_sys_t *)malloc(sizeof(encoder_sys_t)) ) == NULL ) |
|---|
| 1667 | | { |
|---|
| 1668 | | msg_Err( p_enc, "out of memory" ); |
|---|
| 1669 | 1667 | return VLC_ENOMEM; |
|---|
| 1670 | | } |
|---|
| 1671 | 1668 | p_enc->p_sys = p_sys; |
|---|
| 1672 | 1669 | |
|---|
| r5e15258 |
r37a2578 |
|
| 161 | 161 | p_dec->p_sys = p_sys = malloc( sizeof( *p_sys ) ); |
|---|
| 162 | 162 | if( p_sys == NULL ) |
|---|
| 163 | | { |
|---|
| 164 | | msg_Err( p_dec, "out of memory" ); |
|---|
| 165 | 163 | return VLC_ENOMEM; |
|---|
| 166 | | } |
|---|
| 167 | 164 | |
|---|
| 168 | 165 | /* init of p_sys */ |
|---|
| recbf636 |
r37a2578 |
|
| 80 | 80 | (decoder_sys_t *)calloc(1, sizeof(decoder_sys_t)) ) == NULL ) |
|---|
| 81 | 81 | { |
|---|
| 82 | | msg_Err( p_dec, "out of memory" ); |
|---|
| 83 | 82 | return VLC_ENOMEM; |
|---|
| 84 | 83 | } |
|---|
| … | … | |
| 401 | 400 | if( ! p_text_region->psz_html ) |
|---|
| 402 | 401 | { |
|---|
| 403 | | msg_Err( p_dec, "out of memory" ); |
|---|
| 404 | 402 | p_spu->pf_destroy_region( VLC_OBJECT(p_dec), p_text_region ); |
|---|
| 405 | 403 | return NULL; |
|---|
| … | … | |
| 650 | 648 | if( ! p_style ) |
|---|
| 651 | 649 | { |
|---|
| 652 | | msg_Err( p_dec, "out of memory" ); |
|---|
| 653 | 650 | free( psz_node ); |
|---|
| 654 | 651 | break; |
|---|
| r080410c |
r37a2578 |
|
| 357 | 357 | avi_track_t *tk = malloc( sizeof( avi_track_t ) ); |
|---|
| 358 | 358 | if( !tk ) |
|---|
| 359 | | { |
|---|
| 360 | | msg_Err( p_demux, "Out of memory" ); |
|---|
| 361 | 359 | goto error; |
|---|
| 362 | | } |
|---|
| 363 | 360 | |
|---|
| 364 | 361 | avi_chunk_list_t *p_strl = AVI_ChunkFind( p_hdrl, AVIFOURCC_strl, i ); |
|---|
| r3561b9b |
r37a2578 |
|
| 157 | 157 | } |
|---|
| 158 | 158 | p_line = malloc( i + 1 ); |
|---|
| 159 | | if( NULL == p_line ) |
|---|
| 160 | | { |
|---|
| 161 | | msg_Err( p_demux, "out of memory" ); |
|---|
| | 159 | if( p_line == NULL ) |
|---|
| 162 | 160 | return NULL; |
|---|
| 163 | | } |
|---|
| 164 | 161 | strncpy ( p_line, (char*)p_buf, i ); |
|---|
| 165 | 162 | p_line[i] = '\0'; |
|---|
| r3597618 |
r37a2578 |
|
| 546 | 546 | strlen(psz_uri) +1 ); |
|---|
| 547 | 547 | if( !psz_tmp ) |
|---|
| 548 | | { |
|---|
| 549 | | msg_Err( p_demux, "out of memory"); |
|---|
| 550 | 548 | return false; |
|---|
| 551 | | } |
|---|
| 552 | 549 | sprintf( psz_tmp, "%s%s", |
|---|
| 553 | 550 | p_demux->p_sys->psz_base, psz_uri ); |
|---|
| r3561b9b |
r37a2578 |
|
| 450 | 450 | sizeof(subtitle_t) * i_max ) ) ) |
|---|
| 451 | 451 | { |
|---|
| 452 | | msg_Err( p_demux, "out of memory"); |
|---|
| 453 | 452 | free( p_sys->subtitle ); |
|---|
| 454 | 453 | TextUnload( &p_sys->txt ); |
|---|
| r3561b9b |
r37a2578 |
|
| 141 | 141 | p_demux->pf_control = Control; |
|---|
| 142 | 142 | p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) ); |
|---|
| | 143 | if( !p_sys ) |
|---|
| | 144 | return VLC_ENOMEM; |
|---|
| 143 | 145 | p_sys->psz_header = NULL; |
|---|
| 144 | 146 | p_sys->i_subtitle = 0; |
|---|
| … | … | |
| 221 | 223 | if( !p_data ) |
|---|
| 222 | 224 | { |
|---|
| 223 | | msg_Err( p_demux, "out of memory"); |
|---|
| 224 | 225 | free( p_sys ); |
|---|
| 225 | 226 | return VLC_ENOMEM; |
|---|
| … | … | |
| 282 | 283 | * p_sys->i_subs_alloc ) ) ) |
|---|
| 283 | 284 | { |
|---|
| 284 | | msg_Err( p_demux, "out of memory"); |
|---|
| 285 | 285 | return VLC_ENOMEM; |
|---|
| 286 | 286 | } |
|---|