Changeset 945:facac9263129 in mediastreamer2


Ignore:
Timestamp:
Apr 14, 2010 1:12:16 PM (3 years ago)
Author:
Aymeric Moizard <jack@…>
Branch:
default
Message:

fix memory issue with duplicate

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/macsnd.c

    r922 r945  
    134134static MSSndCard *cacard_duplicate(MSSndCard * obj) 
    135135{ 
     136        CaSndDsCard *ca; 
     137        CaSndDsCard *cadup; 
    136138        MSSndCard *card = ms_snd_card_new(&ca_card_desc); 
    137139        card->name = ms_strdup(obj->name); 
    138140        card->data = ms_new0(CaSndDsCard, 1); 
    139141        memcpy(card->data, obj->data, sizeof(CaSndDsCard)); 
     142        ca = obj->data; 
     143        cadup = card->data; 
     144        cadup->uidname = CFStringCreateCopy(NULL, ca->uidname); 
    140145        return card; 
    141146} 
     
    576581         
    577582        comp = FindNextComponent(NULL, &desc); 
    578         if (comp == NULL) return -1; 
     583        if (comp == NULL) 
     584        { 
     585                ms_message("Cannot find audio component"); 
     586                return -1; 
     587        } 
    579588         
    580589        result = OpenAComponent(comp, &d->caInAudioUnit); 
    581         if(result != noErr) return -1; 
     590        if(result != noErr) 
     591        { 
     592                ms_message("Cannot open audio component %x", result); 
     593                return -1; 
     594        } 
    582595         
    583596        param = 1; 
     
    696709         
    697710        comp = FindNextComponent(NULL, &desc); 
    698         if (comp == NULL) return -1; 
     711        if (comp == NULL) 
     712        { 
     713                ms_message("Cannot find audio component"); 
     714                return -1; 
     715        } 
    699716         
    700717        result = OpenAComponent(comp, &d->caOutAudioUnit); 
    701         if(result != noErr) return -1; 
     718        if(result != noErr) 
     719        { 
     720                ms_message("Cannot open audio component %x", result); 
     721                return -1; 
     722        } 
    702723         
    703724        param = 1; 
Note: See TracChangeset for help on using the changeset viewer.