1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-09 22:53:55 +01:00

Remove naked malloc (or similar) and free in: other effects

This commit is contained in:
Paul Licameli
2016-08-13 11:14:00 -04:00
parent 0c7e467a08
commit cab99f7234
5 changed files with 42 additions and 83 deletions

View File

@@ -277,7 +277,8 @@ void AUControl::CreateCocoa()
return;
}
AudioUnitCocoaViewInfo *viewInfo = (AudioUnitCocoaViewInfo *) malloc(dataSize);
ArrayOf<char> buffer{ dataSize };
auto viewInfo = (AudioUnitCocoaViewInfo *) buffer.get();
if (viewInfo == NULL)
{
return;
@@ -331,8 +332,6 @@ void AUControl::CreateCocoa()
}
}
free(viewInfo);
if (!mView)
{
return;
@@ -474,7 +473,8 @@ void AUControl::CreateCarbon()
return;
}
AudioComponentDescription *compList = (AudioComponentDescription *) malloc(dataSize);
ArrayOf<char> buffer{ dataSize };
auto compList = (AudioComponentDescription *) buffer.get();
if (compList == NULL)
{
return;
@@ -488,11 +488,7 @@ void AUControl::CreateCarbon()
compList,
&dataSize);
if (result != noErr)
{
free(compList);
return;
}
// Get the component
AudioComponent comp = AudioComponentFindNext(NULL, &compList[0]);
@@ -500,9 +496,6 @@ void AUControl::CreateCarbon()
// Try to create an instance
result = AudioComponentInstanceNew(comp, &mInstance);
// Done with the list
free(compList);
if (result != noErr)
{
return;