aboutsummaryrefslogtreecommitdiff
path: root/src/path.h
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2006-08-14 13:46:51 +0000
committerEric Wong <normalperson@yhbt.net>2006-08-14 13:46:51 +0000
commit6459b3ee29e13d5141b9e7b40bb4abce68c404be (patch)
tree647c70e2896da491a1b96db0dd7f7c9ddb87b4d2 /src/path.h
parent4fe965c3044888bafa6c86e40724c20faa16f972 (diff)
Revert leaks from r4311, and also the leak fixes as a result of that
utf8ToFsCharset() and fsCharsetToUtf8() got very broken in r4311, and resulted in several commits to fix those leaks. Unfortunately, not all of those newly introduced leaks were fixed, nor was the result pretty. Also, fixed a double-free in lsPlaylists(). This is very hard to trigger (and therefore exploit) at the moment because we check printDirectoryInfo() beforehand. Intended behavior for utf8ToFsCharset() and fsCharsetToUtf8() as God^H^H^Hshank originally intended is now documented in path.h to prevent future errors like this. mpd could still use some good valgrind testing before the 0.12.0 release. <plug>In addition to reducing heap fragmentation, malloc reductions from mpd-ke greatly reduces the chance of leaks from happening due to programming errors.</plug> git-svn-id: https://svn.musicpd.org/mpd/trunk@4639 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/path.h')
-rw-r--r--src/path.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/path.h b/src/path.h
index 222e145a..e9fd36fa 100644
--- a/src/path.h
+++ b/src/path.h
@@ -29,8 +29,17 @@ void initPaths();
void finishPaths();
+/* utf8ToFsCharset() and fsCharsetToUtf8()
+ * Each returns a static pointer to a dynamically allocated buffer
+ * which means:
+ * - Do not manually free the return value of these functions, it'll be
+ * automatically freed the next time it is called.
+ * - They are not reentrant, strdup the return value immediately if
+ * you expect to call one of these functions again, but still need the
+ * previous result.
+ * - The static pointer is unique to each function.
+ */
char *utf8ToFsCharset(char *str);
-
char *fsCharsetToUtf8(char *str);
void setFsCharset(char *charset);