fix a memory leak in ot::read_comments

This commit is contained in:
Frédéric Mangano-Tarumi 2019-01-08 20:57:55 -05:00
parent d09d7bd634
commit 8d287a8070

View File

@ -194,10 +194,12 @@ ot::status ot::read_comments(FILE* input, std::list<std::string>& comments)
}
std::string utf8;
ot::status rc = to_utf8(line, nread, utf8);
if (rc == ot::st::ok)
if (rc == ot::st::ok) {
comments.emplace_back(std::move(utf8));
else
} else {
free(line);
return {ot::st::badly_encoded, "UTF-8 conversion error: " + rc.message};
}
}
free(line);
return ot::st::ok;