mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Merge Richard Cohen branch 'fix-some-leaks-on-error-path' into stable #1714
This commit is contained in:
commit
920f760dd8
@ -49,7 +49,11 @@ GncTokenizer::load_file(const std::string& path)
|
||||
GError *error = nullptr;
|
||||
|
||||
if (!g_file_get_contents(path.c_str(), &raw_contents, &raw_length, &error))
|
||||
throw std::ifstream::failure(error->message);
|
||||
{
|
||||
std::string msg {error->message};
|
||||
g_error_free (error);
|
||||
throw std::ifstream::failure {msg};
|
||||
}
|
||||
|
||||
m_raw_contents = raw_contents;
|
||||
g_free(raw_contents);
|
||||
|
@ -46,14 +46,16 @@ boolean_to_dom_tree (const char* tag, gboolean val)
|
||||
xmlNodePtr
|
||||
text_to_dom_tree (const char* tag, const char* str)
|
||||
{
|
||||
xmlNodePtr result;
|
||||
gchar* newstr = g_strdup (str);
|
||||
g_return_val_if_fail (tag, NULL);
|
||||
g_return_val_if_fail (str, NULL);
|
||||
result = xmlNewNode (NULL, BAD_CAST tag);
|
||||
|
||||
xmlNodePtr result = xmlNewNode (NULL, BAD_CAST tag);
|
||||
g_return_val_if_fail (result, NULL);
|
||||
|
||||
gchar* newstr = g_strdup (str);
|
||||
xmlNodeAddContent (result, checked_char_cast (newstr));
|
||||
g_free (newstr);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user