Skip to content

Commit

Permalink
ext: use xmlFree() instead of free() in Document#set_encoding
Browse files Browse the repository at this point in the history
to match the allocation done by xmlStrdup()

Related to e221b2c
  • Loading branch information
flavorjones committed Aug 6, 2021
1 parent b016ff3 commit 1ef7dff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ext/nokogiri/xml_document.c
Expand Up @@ -213,7 +213,7 @@ set_encoding(VALUE self, VALUE encoding)
Data_Get_Struct(self, xmlDoc, doc);

if (doc->encoding) {
free((char *)(uintptr_t) doc->encoding); /* avoid gcc cast warning */
xmlFree((xmlChar *)(uintptr_t) doc->encoding); /* avoid gcc cast warning */
}

doc->encoding = xmlStrdup((xmlChar *)StringValueCStr(encoding));
Expand Down

0 comments on commit 1ef7dff

Please sign in to comment.