Changeset 676

Show
Ignore:
Timestamp:
12/18/09 06:15:38 (2 years ago)
Author:
erikd
Message:

Fix memory leak in ALSA, OSS and Solaris drivers.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sweep/trunk/src/driver_alsa.c

    r674 r676  
    6565#endif 
    6666 
     67static sw_handle alsa_handle = { 
     68 0, -1, 0, 0, NULL 
     69}; 
     70 
     71 
    6772void print_pcm_state (snd_pcm_t * pcm) 
    6873{ 
     
    124129  char * alsa_pcm_name; 
    125130  snd_pcm_t * pcm_handle; 
    126   sw_handle * handle
     131  sw_handle * handle = &alsa_handle
    127132  snd_pcm_stream_t stream; 
    128133 
     
    150155    return NULL; 
    151156  } 
    152  
    153   handle = g_malloc0 (sizeof (sw_handle)); 
    154157 
    155158  handle->driver_flags = flags; 
     
    444447  
    445448  snd_pcm_close (pcm_handle); 
     449  handle->custom_data = NULL; 
    446450} 
    447451 
  • sweep/trunk/src/driver_oss.c

    r674 r676  
    7777static int frame; 
    7878 
    79  
     79static sw_handle oss_handle = { 
     80 0, -1, 0, 0, NULL 
     81}; 
    8082 
    8183/* driver functions */ 
     
    98100  char * dev_name; 
    99101  int dev_dsp; 
    100   sw_handle * handle
     102  sw_handle * handle = &oss_handle
    101103  int i; 
    102104 
     
    117119  } 
    118120 
    119   handle = g_malloc0 (sizeof (sw_handle)); 
    120121  handle->driver_flags = flags; 
    121122  handle->driver_fd = dev_dsp; 
     
    431432{ 
    432433  close (handle->driver_fd); 
     434  handle->driver_fd = -1; 
    433435} 
    434436 
  • sweep/trunk/src/driver_solaris.c

    r674 r676  
    4848#define DEV_AUDIO "/dev/audio" 
    4949 
     50static sw_handle dev_audio_handle = { 
     51 0, -1, 0, 0, NULL 
     52}; 
     53 
    5054static sw_handle * 
    5155open_dev_audio (int cueing, int flags) 
    5256{ 
    5357  int dev_audio; 
    54   sw_handle * handle
     58  sw_handle * handle = &dev_audio_handle
    5559 
    5660  if (cueing) return NULL; 
     
    6165  } 
    6266 
    63   handle = g_malloc0 (sizeof (sw_handle)); 
    6467  handle->driver_flags = flags; 
    6568  handle->driver_fd = dev_audio; 
     
    113116{ 
    114117  close (handle->driver_fd); 
     118  handle->driver_fd = -1; 
    115119} 
    116120