From ad5c6ceab1420aabbe4c751080bce8b2363abd11 Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Mon, 3 Mar 2014 22:44:59 +0100 Subject: More memory leak fixes (Bug #1275170) (bzr r13105) --- src/extension/internal/javafx-out.cpp | 4 +++- src/sp-conn-end-pair.cpp | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/extension/internal/javafx-out.cpp b/src/extension/internal/javafx-out.cpp index 035a6f0aa..e51e8d539 100644 --- a/src/extension/internal/javafx-out.cpp +++ b/src/extension/internal/javafx-out.cpp @@ -396,12 +396,14 @@ bool JavaFXOutput::doStyle(SPStyle *style) } else if (fill.isPaintserver()){ if (fill.value.href && fill.value.href->getURI() ){ - String uri = fill.value.href->getURI()->toString(); + gchar *str = fill.value.href->getURI()->toString(); + String uri = (str ? str : ""); /* trim the anchor '#' from the front */ if (uri.size() > 0 && uri[0]=='#') { uri = uri.substr(1); } out(" fill: %s()\n", sanatize(uri).c_str()); + g_free(str); } } diff --git a/src/sp-conn-end-pair.cpp b/src/sp-conn-end-pair.cpp index 52a421550..dbd4f2e94 100644 --- a/src/sp-conn-end-pair.cpp +++ b/src/sp-conn-end-pair.cpp @@ -171,8 +171,11 @@ SPConnEndPair::writeRepr(Inkscape::XML::Node *const repr) const { char const * const attr_strs[] = {"inkscape:connection-start", "inkscape:connection-end"}; for (unsigned handle_ix = 0; handle_ix < 2; ++handle_ix) { - if (this->_connEnd[handle_ix]->ref.getURI()) { - repr->setAttribute(attr_strs[handle_ix], this->_connEnd[handle_ix]->ref.getURI()->toString()); + const Inkscape::URI* U = this->_connEnd[handle_ix]->ref.getURI(); + if (U) { + gchar *str = U->toString(); + repr->setAttribute(attr_strs[handle_ix], str); + g_free(str); } } repr->setAttribute("inkscape:connector-curvature", Glib::Ascii::dtostr(_connCurvature).c_str()); -- cgit v1.2.3