Changeset 7eaca895c90b3f14ab208373d0213d0579515e70
- Timestamp:
- 05/22/08 23:24:08
(3 months ago)
- Author:
- Rémi Duraffort <ivoire@videolan.org>
- git-committer:
- Rémi Duraffort <ivoire@videolan.org> 1211491448 +0200
- git-parent:
[fa781f2253cc4438cddfc4420b23496a42df66bd]
- git-author:
- Rémi Duraffort <ivoire@videolan.org> 1211486308 +0200
- Message:
Check malloc return value when needed and don't print an error when such error happend.
Fix a potential segfault.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r13ae40b |
r7eaca89 |
|
| 91 | 91 | p_vout->p_sys = malloc( sizeof( vout_sys_t ) ); |
|---|
| 92 | 92 | if( p_vout->p_sys == NULL ) |
|---|
| 93 | | { |
|---|
| 94 | | msg_Err( p_vout, "out of memory" ); |
|---|
| 95 | 93 | return( 1 ); |
|---|
| 96 | | } |
|---|
| 97 | 94 | |
|---|
| 98 | 95 | /* Don't parse any options, but take $AAOPTS into account */ |
|---|
| r13ae40b |
r7eaca89 |
|
| 164 | 164 | p_vout->p_sys = malloc( sizeof( vout_sys_t ) ); |
|---|
| 165 | 165 | if( p_vout->p_sys == NULL ) |
|---|
| 166 | | { |
|---|
| 167 | | msg_Err( p_vout, "out of memory" ); |
|---|
| 168 | 166 | return VLC_ENOMEM; |
|---|
| 169 | | } |
|---|
| 170 | 167 | |
|---|
| 171 | 168 | p_vout->p_sys->p_cv = cucul_create_canvas(0, 0); |
|---|
| r13ae40b |
r7eaca89 |
|
| 90 | 90 | p_vout->p_sys = p_sys = malloc( sizeof( vout_sys_t ) ); |
|---|
| 91 | 91 | if( !p_sys ) |
|---|
| 92 | | { |
|---|
| 93 | | msg_Err( p_vout, "out of memory" ); |
|---|
| 94 | 92 | return VLC_ENOMEM; |
|---|
| 95 | | } |
|---|
| 96 | 93 | |
|---|
| 97 | 94 | p_sys->p_directfb = NULL; |
|---|
| r13ae40b |
r7eaca89 |
|
| 187 | 187 | p_vout->p_sys = p_sys = malloc( sizeof( vout_sys_t ) ); |
|---|
| 188 | 188 | if( p_vout->p_sys == NULL ) |
|---|
| 189 | | { |
|---|
| 190 | | msg_Err( p_vout, "out of memory" ); |
|---|
| 191 | 189 | return VLC_ENOMEM; |
|---|
| 192 | | }; |
|---|
| 193 | 190 | memset( p_sys, 0, sizeof(vout_sys_t) ); |
|---|
| 194 | 191 | |
|---|
| … | … | |
| 875 | 872 | if( !p_sys->p_palette ) |
|---|
| 876 | 873 | { |
|---|
| 877 | | msg_Err( p_vout, "out of memory" ); |
|---|
| 878 | | |
|---|
| 879 | 874 | /* Restore fb config */ |
|---|
| 880 | 875 | ioctl( p_sys->i_fd, FBIOPUT_VSCREENINFO, &p_sys->old_info ); |
|---|
| r27d483e |
r7eaca89 |
|
| 105 | 105 | p_vout->p_sys = malloc( sizeof( vout_sys_t ) ); |
|---|
| 106 | 106 | if( p_vout->p_sys == NULL ) |
|---|
| 107 | | { |
|---|
| 108 | | msg_Err( p_vout, "out of memory" ); |
|---|
| 109 | | return( 1 ); |
|---|
| 110 | | } |
|---|
| | 107 | return( 1 ); |
|---|
| 111 | 108 | |
|---|
| 112 | 109 | /* Open and initialize device */ |
|---|
| r13ae40b |
r7eaca89 |
|
| 97 | 97 | p_vout->p_sys = malloc( sizeof( vout_sys_t ) ); |
|---|
| 98 | 98 | if( p_vout->p_sys == NULL ) |
|---|
| 99 | | { |
|---|
| 100 | | msg_Err( p_vout, "out of memory" ); |
|---|
| 101 | | return( 1 ); |
|---|
| 102 | | } |
|---|
| | 99 | return( 1 ); |
|---|
| 103 | 100 | |
|---|
| 104 | 101 | /* Open and initialize device */ |
|---|
| r13ae40b |
r7eaca89 |
|
| 98 | 98 | p_vout->p_sys = (struct vout_sys_t*) malloc( sizeof(struct vout_sys_t) ); |
|---|
| 99 | 99 | if( p_vout->p_sys == NULL ) |
|---|
| 100 | | { |
|---|
| 101 | | msg_Err( p_vout, "out of memory" ); |
|---|
| 102 | | return VLC_EGENERIC; |
|---|
| 103 | | } |
|---|
| | 100 | return VLC_ENOMEM; |
|---|
| 104 | 101 | |
|---|
| 105 | 102 | /* Allocate a screen for VLC vout. */ |
|---|
| r13ae40b |
r7eaca89 |
|
| 316 | 316 | psz_filename = (char *)malloc( 10 + strlen( psz_prefix ) |
|---|
| 317 | 317 | + strlen( p_vout->p_sys->psz_format ) ); |
|---|
| | 318 | if( !psz_filename ) |
|---|
| | 319 | return; |
|---|
| | 320 | |
|---|
| 318 | 321 | if( p_vout->p_sys->b_replace ) |
|---|
| 319 | 322 | { |
|---|
| r13ae40b |
r7eaca89 |
|
| 138 | 138 | p_vout->p_sys = malloc( sizeof( vout_sys_t ) ); |
|---|
| 139 | 139 | if( p_vout->p_sys == NULL ) |
|---|
| 140 | | { |
|---|
| 141 | | msg_Err( p_vout, "out of memory" ); |
|---|
| 142 | 140 | return( 1 ); |
|---|
| 143 | | } |
|---|
| 144 | 141 | |
|---|
| 145 | 142 | p_vout->p_sys->i_fd = open( "/dev/mga_vid", O_RDWR ); |
|---|
| r13ae40b |
r7eaca89 |
|
| 154 | 154 | p_vout->p_sys = malloc( sizeof( vout_sys_t ) ); |
|---|
| 155 | 155 | if( p_vout->p_sys == NULL ) |
|---|
| 156 | | { |
|---|
| 157 | | msg_Err( p_vout, "out of memory" ); |
|---|
| 158 | 156 | return VLC_ENOMEM; |
|---|
| 159 | | } |
|---|
| 160 | 157 | memset( p_vout->p_sys, 0, sizeof( vout_sys_t ) ); |
|---|
| 161 | 158 | |
|---|
| r13ae40b |
r7eaca89 |
|
| 211 | 211 | p_vout->p_sys = malloc( sizeof( vout_sys_t ) ); |
|---|
| 212 | 212 | if( p_vout->p_sys == NULL ) |
|---|
| 213 | | { |
|---|
| 214 | | msg_Err( p_vout, "out of memory" ); |
|---|
| 215 | 213 | return VLC_ENOMEM; |
|---|
| 216 | | } |
|---|
| 217 | 214 | memset( p_vout->p_sys, 0, sizeof( vout_sys_t ) ); |
|---|
| 218 | 215 | |
|---|
| r937e898 |
r7eaca89 |
|
| 344 | 344 | { |
|---|
| 345 | 345 | wchar_t *psz_title = malloc( strlen(val.psz_string) * 2 + 2 ); |
|---|
| 346 | | mbstowcs( psz_title, val.psz_string, strlen(val.psz_string)*2); |
|---|
| 347 | | psz_title[strlen(val.psz_string)] = 0; |
|---|
| 348 | | free( val.psz_string ); val.psz_string = (char *)psz_title; |
|---|
| | 346 | if( psz_title ) |
|---|
| | 347 | { |
|---|
| | 348 | mbstowcs( psz_title, val.psz_string, strlen(val.psz_string)*2); |
|---|
| | 349 | psz_title[strlen(val.psz_string)] = 0; |
|---|
| | 350 | free( val.psz_string ); val.psz_string = (char *)psz_title; |
|---|
| | 351 | } |
|---|
| 349 | 352 | } |
|---|
| 350 | 353 | #endif |
|---|
| r13ae40b |
r7eaca89 |
|
| 97 | 97 | p_vout->p_sys = malloc( sizeof( vout_sys_t ) ); |
|---|
| 98 | 98 | if( p_vout->p_sys == NULL ) |
|---|
| 99 | | { |
|---|
| 100 | | msg_Err( p_vout, "out of memory" ); |
|---|
| 101 | 99 | return VLC_ENOMEM; |
|---|
| 102 | | } |
|---|
| 103 | 100 | memset( p_vout->p_sys, 0, sizeof( vout_sys_t ) ); |
|---|
| 104 | 101 | |
|---|
| r13ae40b |
r7eaca89 |
|
| 251 | 251 | p_vout->p_sys = p_sys = malloc( sizeof( vout_sys_t ) ); |
|---|
| 252 | 252 | if( p_sys == NULL ) |
|---|
| 253 | | { |
|---|
| 254 | | msg_Err( p_vout, "out of memory" ); |
|---|
| 255 | | return VLC_EGENERIC; |
|---|
| 256 | | } |
|---|
| | 253 | return VLC_ENOMEM; |
|---|
| 257 | 254 | |
|---|
| 258 | 255 | var_Create( p_vout, "opengl-effect", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); |
|---|
| … | … | |
| 410 | 407 | malloc( p_sys->i_tex_width * p_sys->i_tex_height * i_pixel_pitch ); |
|---|
| 411 | 408 | if( !p_sys->pp_buffer[0] ) |
|---|
| 412 | | { |
|---|
| 413 | | msg_Err( p_vout, "out of memory" ); |
|---|
| 414 | 409 | return -1; |
|---|
| 415 | | } |
|---|
| 416 | 410 | p_sys->pp_buffer[1] = |
|---|
| 417 | 411 | malloc( p_sys->i_tex_width * p_sys->i_tex_height * i_pixel_pitch ); |
|---|
| 418 | 412 | if( !p_sys->pp_buffer[1] ) |
|---|
| 419 | | { |
|---|
| 420 | | msg_Err( p_vout, "out of memory" ); |
|---|
| 421 | 413 | return -1; |
|---|
| 422 | | } |
|---|
| 423 | 414 | |
|---|
| 424 | 415 | p_vout->p_picture[0].i_planes = 1; |
|---|
| r13ae40b |
r7eaca89 |
|
| 144 | 144 | |
|---|
| 145 | 145 | if( p_vout->p_sys == NULL ) |
|---|
| 146 | | { |
|---|
| 147 | | msg_Err( p_vout, "out of memory" ); |
|---|
| 148 | 146 | return( 1 ); |
|---|
| 149 | | } |
|---|
| 150 | 147 | |
|---|
| 151 | 148 | p_vout->pf_init = Init; |
|---|
| r602005b |
r7eaca89 |
|
| 207 | 207 | p_vout->p_sys = malloc( sizeof( vout_sys_t ) ); |
|---|
| 208 | 208 | if( p_vout->p_sys == NULL ) |
|---|
| 209 | | { |
|---|
| 210 | | msg_Err( p_vout, "out of memory" ); |
|---|
| 211 | 209 | return VLC_ENOMEM; |
|---|
| 212 | | } |
|---|
| 213 | 210 | |
|---|
| 214 | 211 | vlc_mutex_init( &p_vout->p_sys->lock ); |
|---|
| … | … | |
| 2943 | 2940 | #endif |
|---|
| 2944 | 2941 | if( !p_data ) |
|---|
| 2945 | | { |
|---|
| 2946 | | msg_Err( p_vout, "out of memory" ); |
|---|
| 2947 | 2942 | return NULL; |
|---|
| 2948 | | } |
|---|
| 2949 | 2943 | |
|---|
| 2950 | 2944 | #ifdef MODULE_NAME_IS_x11 |
|---|