Changeset 4014:2fee6bf2dc0c in roaraudio


Ignore:
Timestamp:
07/01/10 20:04:36 (14 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

fixed some resurce leaks

Location:
roarclients
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • roarclients/roarctl.c

    r4012 r4014  
    736736  } 
    737737 
    738   if ( roar_stream_meta_set(con, &s, mode_i, &meta) == -1 ) 
     738  if ( roar_stream_meta_set(con, &s, mode_i, &meta) == -1 ) { 
     739   fclose(in); 
    739740   return -1; 
     741  } 
    740742 } 
    741743 
     
    801803  return -1; 
    802804 
     805 if ( (len = roar_stream_meta_list(con, &s, types, ROAR_META_MAX_PER_STREAM)) == -1 ) 
     806  return -1; 
     807 
    803808 if ( (out = fopen(file, "w")) == NULL ) 
    804   return -1; 
    805  
    806  if ( (len = roar_stream_meta_list(con, &s, types, ROAR_META_MAX_PER_STREAM)) == -1 ) 
    807809  return -1; 
    808810 
  • roarclients/roardtmf.c

    r3517 r4014  
    170170*/ 
    171171 
    172  if ( (buf = malloc((len = bits*samples/8))) == NULL ) 
     172 if ( (buf = roar_mm_malloc((len = bits*samples/8))) == NULL ) 
    173173  return 4; 
    174174 
    175175 if ( roar_vio_simple_stream(&stream, rate, 1, bits, codec, server, ROAR_DIR_PLAY, name) == -1 ) { 
    176176  fprintf(stderr, "Error: can not start playback\n"); 
     177  roar_mm_free(buf); 
    177178  return 1; 
    178179 } 
     
    184185   continue; 
    185186 
    186   if ( calc(buf, len, rate, c) == -1 ) 
     187  if ( calc(buf, len, rate, c) == -1 ) { 
     188   roar_mm_free(buf); 
    187189   return 5; 
     190  } 
    188191  roar_vio_write(&stream, buf, len); 
    189192 } 
    190193 
    191194 roar_vio_close(&stream); 
     195 
     196 roar_mm_free(buf); 
    192197 
    193198 return 0; 
  • roarclients/roarfctest.c

    r3812 r4014  
    102102#endif 
    103103 
    104  if ( roar_stream_new(stream, rate, channels, bits, codec) == -1 ) 
     104 if ( roar_stream_new(stream, rate, channels, bits, codec) == -1 ) { 
     105  pclose(rmsout); 
    105106  return 2; 
     107 } 
    106108 
    107109 if ( roardsp_filter_init(filt, stream, ROARDSP_FILTER_DCBLOCK) == -1 ) { 
    108110  ROAR_ERR("main(*): roardsp_filter_init() failed: errno=%s(%i)", strerror(errno), errno); 
     111  pclose(rmsout); 
    109112  return 1; 
    110113 } 
     
    117120 if ( roardsp_filter_init(filt+1, stream, ROARDSP_FILTER_HIGHP) == -1 ) { 
    118121  ROAR_ERR("main(*): roardsp_filter_init() failed: errno=%s(%i)", strerror(errno), errno); 
     122  pclose(rmsout); 
    119123  return 1; 
    120124 } 
     
    125129 if ( roardsp_filter_init(filt+2, stream, ROARDSP_FILTER_AMP) == -1 ) { 
    126130  ROAR_ERR("main(*): roardsp_filter_init() failed: errno=%s(%i)", strerror(errno), errno); 
     131  pclose(rmsout); 
    127132  return 1; 
    128133 } 
     
    211216 
    212217 if ( rmsout != NULL ) 
    213   fclose(rmsout); 
     218  pclose(rmsout); 
    214219 
    215220 return 0; 
  • roarclients/roarvorbis.c

    r3843 r4014  
    251251 if ( in == NULL ) { 
    252252  roar_disconnect(&con); 
     253  fclose(in); 
    253254  return 1; 
    254255 } 
     
    261262  fprintf(stderr,"Input does not appear to be an Ogg bitstream.\n"); 
    262263  roar_disconnect(&con); 
     264  fclose(in); 
    263265  return 1; 
    264266 } 
     
    269271  if ( roar_vio_open_dstr(&vclt, vcltfile, &def, 1) == -1 ) { 
    270272   fprintf(stderr, "Error: can not open file: %s: %s\n", k, strerror(errno)); 
     273   fclose(in); 
    271274   return 1; 
    272275  } 
     
    280283 
    281284  if ( last_section != current_section ) 
    282    if ( update_stream(&con, &s, &vio, &vf, file, &info, vcltfile == NULL ? NULL : &vclt) == -1 ) 
     285   if ( update_stream(&con, &s, &vio, &vf, file, &info, vcltfile == NULL ? NULL : &vclt) == -1 ) { 
     286    fclose(in); 
    283287    return 1; 
     288   } 
    284289 
    285290  last_section = current_section; 
     
    306311 } 
    307312 
     313 fclose(in); 
     314 
    308315 return 0; 
    309316#endif 
Note: See TracChangeset for help on using the changeset viewer.