From 45cadef22f6440e815cd2f32419ee5abfd83f13f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 6 Feb 2017 23:28:36 +0100 Subject: [PATCH 1/4] configure.ac: prepare for 0.20.5 --- NEWS | 2 ++ configure.ac | 4 ++-- src/lib/nfs/FileReader.cxx | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index edc8a8c4e..614c92c8f 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ +ver 0.20.5 (not yet released) + ver 0.20.4 (2017/02/01) * input - nfs: fix freeze after reconnect diff --git a/configure.ac b/configure.ac index b18d89d2e..a53913a2d 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ AC_PREREQ(2.60) -AC_INIT(mpd, 0.20.4, musicpd-dev-team@lists.sourceforge.net) +AC_INIT(mpd, 0.20.5, musicpd-dev-team@lists.sourceforge.net) VERSION_MAJOR=0 VERSION_MINOR=20 -VERSION_REVISION=4 +VERSION_REVISION=5 VERSION_EXTRA=0 AC_CONFIG_SRCDIR([src/Main.cxx]) diff --git a/src/lib/nfs/FileReader.cxx b/src/lib/nfs/FileReader.cxx index 21eadc950..eb89a8f15 100644 --- a/src/lib/nfs/FileReader.cxx +++ b/src/lib/nfs/FileReader.cxx @@ -213,6 +213,9 @@ NfsFileReader::StatCallback(const struct stat *st) state = State::IDLE; + if (1==1) + return; + OnNfsFileOpen(st->st_size); } From 69a82eec17d06681de914eb6b6a4fdf9cc19b86f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 6 Feb 2017 23:32:07 +0100 Subject: [PATCH 2/4] tag/TagId3: use AtScopeExit() for exception-safety --- src/tag/TagId3.cxx | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/tag/TagId3.cxx b/src/tag/TagId3.cxx index 3c2e93ad4..f9bf7e9b2 100644 --- a/src/tag/TagId3.cxx +++ b/src/tag/TagId3.cxx @@ -24,6 +24,7 @@ #include "TagTable.hxx" #include "TagBuilder.hxx" #include "util/Alloc.hxx" +#include "util/ScopeExit.hxx" #include "util/StringUtil.hxx" #include "Log.hxx" @@ -78,11 +79,9 @@ import_id3_string(const id3_ucs4_t *ucs4) if (gcc_unlikely(utf8 == nullptr)) return nullptr; - id3_utf8_t *utf8_stripped = (id3_utf8_t *) - xstrdup(Strip((char *)utf8)); - free(utf8); + AtScopeExit(utf8) { free(utf8); }; - return utf8_stripped; + return (id3_utf8_t *)xstrdup(Strip((char *)utf8)); } /** @@ -126,9 +125,10 @@ tag_id3_import_text_frame(const struct id3_frame *frame, if (utf8 == nullptr) continue; + AtScopeExit(utf8) { free(utf8); }; + tag_handler_invoke_tag(handler, handler_ctx, type, (const char *)utf8); - free(utf8); } } @@ -177,8 +177,9 @@ tag_id3_import_comment_frame(const struct id3_frame *frame, TagType type, if (utf8 == nullptr) return; + AtScopeExit(utf8) { free(utf8); }; + tag_handler_invoke_tag(handler, handler_ctx, type, (const char *)utf8); - free(utf8); } /** @@ -236,22 +237,23 @@ tag_id3_import_musicbrainz(struct id3_tag *id3_tag, if (name == nullptr) continue; + AtScopeExit(name) { free(name); }; + id3_utf8_t *value = tag_id3_getstring(frame, 2); if (value == nullptr) continue; + AtScopeExit(value) { free(value); }; + tag_handler_invoke_pair(handler, handler_ctx, (const char *)name, (const char *)value); TagType type = tag_id3_parse_txxx_name((const char*)name); - free(name); if (type != TAG_NUM_OF_ITEM_TYPES) tag_handler_invoke_tag(handler, handler_ctx, type, (const char*)value); - - free(value); } } From 53c14d97a69ae7cf527fe8ff4232db48c7efbb94 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 8 Feb 2017 08:43:56 +0100 Subject: [PATCH 3/4] lib/nfs/FileReader: remove debug line --- src/lib/nfs/FileReader.cxx | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/lib/nfs/FileReader.cxx b/src/lib/nfs/FileReader.cxx index eb89a8f15..21eadc950 100644 --- a/src/lib/nfs/FileReader.cxx +++ b/src/lib/nfs/FileReader.cxx @@ -213,9 +213,6 @@ NfsFileReader::StatCallback(const struct stat *st) state = State::IDLE; - if (1==1) - return; - OnNfsFileOpen(st->st_size); } From 81a97315e35e6aada1e25ca8556488c6aac32e0a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 8 Feb 2017 08:44:47 +0100 Subject: [PATCH 4/4] NEWS: mention ID3 memory leak fix --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 614c92c8f..665e13353 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ ver 0.20.5 (not yet released) +* tags + - id3: fix memory leak on corrupt ID3 tags ver 0.20.4 (2017/02/01) * input