Changeset 7d3cc85d1bc8a3d7aea4f5486148826304b0aa8b
- Timestamp:
- 03/15/08 15:50:27
(6 months ago)
- Author:
- Richard Hosking <richard@hovis.net>
- git-committer:
- Richard Hosking <richard@hovis.net> 1205592627 +0000
- git-parent:
[a19cac2195024dc9992fa582eeb4701602695003]
- git-author:
- Richard Hosking <richard@hovis.net> 1205592627 +0000
- Message:
Fix very minor memory leak when using OSS for audio.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r9630c00 |
r7d3cc85 |
|
| 2452 | 2452 | vlc_bool_t b_demux ) |
|---|
| 2453 | 2453 | { |
|---|
| 2454 | | char *psz_device = p_sys->psz_adev; |
|---|
| 2455 | 2454 | int i_fd = 0; |
|---|
| 2456 | 2455 | int i_format; |
|---|
| 2457 | 2456 | /* OSS */ |
|---|
| 2458 | | if( !psz_device ) psz_device = strdup( OSS_DEFAULT ); /* FIXME leak */ |
|---|
| 2459 | | |
|---|
| 2460 | | if( (i_fd = open( psz_device, O_RDONLY | O_NONBLOCK )) < 0 ) |
|---|
| | 2457 | char* psz_oss_device_name = strdup( ( !p_sys->psz_adev ) ? OSS_DEFAULT : p_sys->psz_adev ); |
|---|
| | 2458 | |
|---|
| | 2459 | if( (i_fd = open( psz_oss_device_name, O_RDONLY | O_NONBLOCK )) < 0 ) |
|---|
| 2461 | 2460 | { |
|---|
| 2462 | 2461 | msg_Err( p_this, "cannot open OSS audio device (%m)" ); |
|---|
| … | … | |
| 2491 | 2490 | if( !p_sys->psz_adev ) |
|---|
| 2492 | 2491 | p_sys->psz_adev = strdup( OSS_DEFAULT ); |
|---|
| | 2492 | free( psz_oss_device_name ); |
|---|
| 2493 | 2493 | return i_fd; |
|---|
| 2494 | 2494 | |
|---|
| 2495 | 2495 | adev_fail: |
|---|
| 2496 | 2496 | |
|---|
| | 2497 | free( psz_oss_device_name ); |
|---|
| 2497 | 2498 | if( i_fd >= 0 ) close( i_fd ); |
|---|
| 2498 | 2499 | return -1; |
|---|
| … | … | |
| 2894 | 2895 | int i_fd = 0; |
|---|
| 2895 | 2896 | int i_caps; |
|---|
| 2896 | | if( !psz_device ) psz_device = strdup( OSS_DEFAULT ); /* FIXME leak */ |
|---|
| 2897 | | |
|---|
| 2898 | | if( ( i_fd = open( psz_device, O_RDONLY | O_NONBLOCK ) ) < 0 ) |
|---|
| 2899 | | { |
|---|
| 2900 | | msg_Err( p_this, "cannot open device %s for OSS audio (%m)", psz_device ); |
|---|
| | 2897 | char* psz_oss_device_name = strdup( ( !psz_device ) ? OSS_DEFAULT : psz_device ); |
|---|
| | 2898 | |
|---|
| | 2899 | if( ( i_fd = open( psz_oss_device_name, O_RDONLY | O_NONBLOCK ) ) < 0 ) |
|---|
| | 2900 | { |
|---|
| | 2901 | msg_Err( p_this, "cannot open device %s for OSS audio (%m)", psz_oss_device_name ); |
|---|
| 2901 | 2902 | goto open_failed; |
|---|
| 2902 | 2903 | } |
|---|
| … | … | |
| 2909 | 2910 | } |
|---|
| 2910 | 2911 | |
|---|
| | 2912 | free( psz_oss_device_name ); |
|---|
| 2911 | 2913 | if( i_fd >= 0 ) close( i_fd ); |
|---|
| 2912 | 2914 | |
|---|
| … | … | |
| 2914 | 2916 | |
|---|
| 2915 | 2917 | open_failed: |
|---|
| | 2918 | free( psz_oss_device_name ); |
|---|
| 2916 | 2919 | if( i_fd >= 0 ) close( i_fd ); |
|---|
| 2917 | 2920 | return VLC_FALSE; |
|---|