From 7c9b141d551fde406f199f0dd21582f8551aea23 Mon Sep 17 00:00:00 2001 From: Marco Nelissen Date: Tue, 6 May 2014 10:33:07 -0700 Subject: MediaFormat owns its strings Have MediaFormat own the strings it returns from toString and getString, reducing the chance of memory leaks. Change-Id: I0ddd593874c8b3af0b7714f2d8a106edf8121108 --- include/ndk/NdkMediaFormat.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/ndk/NdkMediaFormat.h b/include/ndk/NdkMediaFormat.h index 16f4348..4489b78 100644 --- a/include/ndk/NdkMediaFormat.h +++ b/include/ndk/NdkMediaFormat.h @@ -40,7 +40,8 @@ AMediaFormat *AMediaFormat_new(); int AMediaFormat_delete(AMediaFormat*); /** - * Debug string. Caller must free. + * Human readable representation of the format. The returned string is owned by the format, + * and remains valid until the next call to toString, or until the format is deleted. */ const char* AMediaFormat_toString(AMediaFormat*); @@ -50,7 +51,8 @@ bool AMediaFormat_getFloat(AMediaFormat*, const char *name, float *out); bool AMediaFormat_getDouble(AMediaFormat*, const char *name, double *out); bool AMediaFormat_getSize(AMediaFormat*, const char *name, size_t *out); /** - * Caller must free the returned string + * The returned string is owned by the format, and remains valid until the next call to getString, + * or until the format is deleted. */ bool AMediaFormat_getString(AMediaFormat*, const char *name, const char **out); -- cgit v1.1