Changeset 2da7526


Ignore:
Timestamp:
Nov 2, 2015, 12:18:30 AM (8 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
43b7c6d
Parents:
9ee1ee9
Message:

src/io/{sink,source,utils}_apple_audio.c: fix memory leak calling CFRelease (closes #26, closes #27, and closes #28)

Location:
src/io
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/io/sink_apple_audio.c

    r9ee1ee9 r2da7526  
    3737extern int createAubioBufferList(AudioBufferList *bufferList, int channels, int segmentSize);
    3838extern void freeAudioBufferList(AudioBufferList *bufferList);
    39 extern CFURLRef getURLFromPath(const char * path);
     39extern CFURLRef createURLFromPath(const char * path);
    4040char_t *getPrintableOSStatusError(char_t *str, OSStatus error);
    4141
     
    138138
    139139  AudioFileTypeID fileType = kAudioFileWAVEType;
    140   CFURLRef fileURL = getURLFromPath(s->path);
     140  CFURLRef fileURL = createURLFromPath(s->path);
    141141  bool overwrite = true;
    142142  OSStatus err = noErr;
    143143  err = ExtAudioFileCreateWithURL(fileURL, fileType, &clientFormat, NULL,
    144144     overwrite ? kAudioFileFlags_EraseFile : 0, &s->audioFile);
     145  CFRelease(fileURL);
    145146  if (err) {
    146147    char_t errorstr[20];
  • src/io/source_apple_audio.c

    r9ee1ee9 r2da7526  
    5252extern int createAubioBufferList(AudioBufferList *bufferList, int channels, int max_source_samples);
    5353extern void freeAudioBufferList(AudioBufferList *bufferList);
    54 extern CFURLRef getURLFromPath(const char * path);
     54extern CFURLRef createURLFromPath(const char * path);
    5555char_t *getPrintableOSStatusError(char_t *str, OSStatus error);
    5656
     
    9999
    100100  // open the resource url
    101   CFURLRef fileURL = getURLFromPath(path);
     101  CFURLRef fileURL = createURLFromPath(path);
    102102  err = ExtAudioFileOpenURL(fileURL, &s->audioFile);
     103  CFRelease(fileURL);
    103104  if (err == -43) {
    104105    AUBIO_ERR("source_apple_audio: Failed opening %s, "
  • src/io/utils_apple_audio.c

    r9ee1ee9 r2da7526  
    3434}
    3535
    36 CFURLRef getURLFromPath(const char * path) {
     36CFURLRef createURLFromPath(const char * path) {
    3737  CFStringRef cfTotalPath = CFStringCreateWithCString (kCFAllocatorDefault,
    3838      path, kCFStringEncodingUTF8);
    3939
    40   return CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfTotalPath,
     40  CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfTotalPath,
    4141      kCFURLPOSIXPathStyle, false);
     42  CFRelease(cfTotalPath);
     43  return url;
    4244}
    4345
Note: See TracChangeset for help on using the changeset viewer.