ao_coreaudio: fix some minor memory leaks

This commit is contained in:
wm4 2015-10-21 18:53:34 +02:00
parent eb66038d4f
commit cee9aeaf6b
1 changed files with 6 additions and 0 deletions

View File

@ -180,6 +180,8 @@ static void init_physical_format(struct ao *ao)
struct priv *p = ao->priv; struct priv *p = ao->priv;
OSErr err; OSErr err;
void *tmp = talloc_new(NULL);
AudioStreamBasicDescription asbd; AudioStreamBasicDescription asbd;
ca_fill_asbd(ao, &asbd); ca_fill_asbd(ao, &asbd);
@ -190,6 +192,8 @@ static void init_physical_format(struct ao *ao)
&streams, &n_streams); &streams, &n_streams);
CHECK_CA_ERROR("could not get number of streams"); CHECK_CA_ERROR("could not get number of streams");
talloc_steal(tmp, streams);
MP_VERBOSE(ao, "Found %zd substream(s).\n", n_streams); MP_VERBOSE(ao, "Found %zd substream(s).\n", n_streams);
for (int i = 0; i < n_streams; i++) { for (int i = 0; i < n_streams; i++) {
@ -204,6 +208,7 @@ static void init_physical_format(struct ao *ao)
if (!CHECK_CA_WARN("could not get number of stream formats")) if (!CHECK_CA_WARN("could not get number of stream formats"))
continue; // try next one continue; // try next one
talloc_steal(tmp, formats);
uint32_t direction; uint32_t direction;
err = CA_GET(streams[i], kAudioStreamPropertyDirection, &direction); err = CA_GET(streams[i], kAudioStreamPropertyDirection, &direction);
@ -239,6 +244,7 @@ static void init_physical_format(struct ao *ao)
} }
coreaudio_error: coreaudio_error:
talloc_free(tmp);
return; return;
} }