You need to sign in or sign up before continuing.
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.20.5 (not yet released)
* tags
- id3: fix memory leak on corrupt ID3 tags
ver 0.20.4 (2017/02/01)
* input
- nfs: fix freeze after reconnect
......
......@@ -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);
}
}
......
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