summaryrefslogtreecommitdiffstats
path: root/audio/audio.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-11-24 19:56:01 +0100
committerwm4 <wm4@nowhere>2014-11-24 19:56:01 +0100
commit28b6ce39d3d88d0159b54c8ca558e993eac93056 (patch)
treefa3c94a84cd2efebf24b1ea5fd75dd1fbcc01c12 /audio/audio.c
parent2228d4737367fb0303bec263bc06ca90c9ff8757 (diff)
downloadmpv-28b6ce39d3d88d0159b54c8ca558e993eac93056.tar.bz2
mpv-28b6ce39d3d88d0159b54c8ca558e993eac93056.tar.xz
audio: make mp_chmap_to_str() return a stack-allocated string
Simplifies memory management.
Diffstat (limited to 'audio/audio.c')
-rw-r--r--audio/audio.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/audio/audio.c b/audio/audio.c
index 0458e813e7..2cda1ba110 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -93,10 +93,9 @@ bool mp_audio_config_valid(const struct mp_audio *mpa)
char *mp_audio_fmt_to_str(int srate, const struct mp_chmap *chmap, int format)
{
- char *chstr = mp_chmap_to_str(chmap);
- char *res = talloc_asprintf(NULL, "%dHz %s %dch %s", srate, chstr,
- chmap->num, af_fmt_to_str(format));
- talloc_free(chstr);
+ char *res = talloc_asprintf(NULL, "%dHz %s %dch %s", srate,
+ mp_chmap_to_str(chmap), chmap->num,
+ af_fmt_to_str(format));
return res;
}