Commit 07ce915c authored by Max Kellermann's avatar Max Kellermann

Merge branch 'v0.20.x'

parents 73f58c57 81a97315
ver 0.21 (not yet released) ver 0.21 (not yet released)
ver 0.20.5 (not yet released)
* tags
- id3: fix memory leak on corrupt ID3 tags
ver 0.20.4 (2017/02/01) ver 0.20.4 (2017/02/01)
* input * input
- nfs: fix freeze after reconnect - nfs: fix freeze after reconnect
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "TagTable.hxx" #include "TagTable.hxx"
#include "TagBuilder.hxx" #include "TagBuilder.hxx"
#include "util/Alloc.hxx" #include "util/Alloc.hxx"
#include "util/ScopeExit.hxx"
#include "util/StringUtil.hxx" #include "util/StringUtil.hxx"
#include "Log.hxx" #include "Log.hxx"
...@@ -78,11 +79,9 @@ import_id3_string(const id3_ucs4_t *ucs4) ...@@ -78,11 +79,9 @@ import_id3_string(const id3_ucs4_t *ucs4)
if (gcc_unlikely(utf8 == nullptr)) if (gcc_unlikely(utf8 == nullptr))
return nullptr; return nullptr;
id3_utf8_t *utf8_stripped = (id3_utf8_t *) AtScopeExit(utf8) { free(utf8); };
xstrdup(Strip((char *)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, ...@@ -126,9 +125,10 @@ tag_id3_import_text_frame(const struct id3_frame *frame,
if (utf8 == nullptr) if (utf8 == nullptr)
continue; continue;
AtScopeExit(utf8) { free(utf8); };
tag_handler_invoke_tag(handler, handler_ctx, tag_handler_invoke_tag(handler, handler_ctx,
type, (const char *)utf8); type, (const char *)utf8);
free(utf8);
} }
} }
...@@ -177,8 +177,9 @@ tag_id3_import_comment_frame(const struct id3_frame *frame, TagType type, ...@@ -177,8 +177,9 @@ tag_id3_import_comment_frame(const struct id3_frame *frame, TagType type,
if (utf8 == nullptr) if (utf8 == nullptr)
return; return;
AtScopeExit(utf8) { free(utf8); };
tag_handler_invoke_tag(handler, handler_ctx, type, (const char *)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, ...@@ -236,22 +237,23 @@ tag_id3_import_musicbrainz(struct id3_tag *id3_tag,
if (name == nullptr) if (name == nullptr)
continue; continue;
AtScopeExit(name) { free(name); };
id3_utf8_t *value = tag_id3_getstring(frame, 2); id3_utf8_t *value = tag_id3_getstring(frame, 2);
if (value == nullptr) if (value == nullptr)
continue; continue;
AtScopeExit(value) { free(value); };
tag_handler_invoke_pair(handler, handler_ctx, tag_handler_invoke_pair(handler, handler_ctx,
(const char *)name, (const char *)name,
(const char *)value); (const char *)value);
TagType type = tag_id3_parse_txxx_name((const char*)name); TagType type = tag_id3_parse_txxx_name((const char*)name);
free(name);
if (type != TAG_NUM_OF_ITEM_TYPES) if (type != TAG_NUM_OF_ITEM_TYPES)
tag_handler_invoke_tag(handler, handler_ctx, tag_handler_invoke_tag(handler, handler_ctx,
type, (const char*)value); type, (const char*)value);
free(value);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment