From: tsteven4 Date: Sun, 4 Aug 2013 23:01:55 +0000 (+0000) Subject: fix memory leak in strip_html(). X-Git-Tag: archive/raspbian/1.10.0+ds-2+rpi1~1^2~12^2~11^2~454 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=50fba61bdc8a8c29d62ca52f59c7cd0c0f5bc65f;p=gpsbabel.git fix memory leak in strip_html(). --- diff --git a/gpsbabel/util.cc b/gpsbabel/util.cc index 1bc16c2e8..d908e8c91 100644 --- a/gpsbabel/util.cc +++ b/gpsbabel/util.cc @@ -1563,7 +1563,8 @@ strip_html(const utf_string *in) char* outstring, *out; // If toUtf8() is used here, we double encode in the OSM test case. // this may be a bug here or elsewhere. - char* instr = xstrdup(in->utfstring.toLatin1().data()); + char* incopy, *instr; + incopy = instr = xstrdup(in->utfstring.toLatin1().data()); char tag[8]; unsigned short int taglen = 0; @@ -1637,6 +1638,9 @@ strip_html(const utf_string *in) instr++; } *out++ = 0; + if (incopy) { + xfree(incopy); + } return (outstring); }