summaryrefslogtreecommitdiffstats
path: root/src/style.cpp
diff options
context:
space:
mode:
authorKris De Gussem <kris.degussem@gmail.com>2012-09-20 20:40:55 +0000
committerKris <Kris.De.Gussem@hotmail.com>2012-09-20 20:40:55 +0000
commitbac4df147de363a0774548acd63d367a09ab50d3 (patch)
tree849f3bc54cfa4ba5d9e219173bcc5d5240b38375 /src/style.cpp
parentTranslations. inkscape.pot update. (diff)
downloadinkscape-bac4df147de363a0774548acd63d367a09ab50d3.tar.gz
inkscape-bac4df147de363a0774548acd63d367a09ab50d3.zip
some memleak fixes (Bug #1043571)
(bzr r11686)
Diffstat (limited to 'src/style.cpp')
-rw-r--r--src/style.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/style.cpp b/src/style.cpp
index 2facc86d8..616474298 100644
--- a/src/style.cpp
+++ b/src/style.cpp
@@ -3890,10 +3890,9 @@ sp_style_write_istring(gchar *p, gint const len, gchar const *const key,
if (val->inherit) {
res = g_snprintf(p, len, "%s:inherit;", key);
} else {
- gchar *val_quoted = css2_escape_quote(val->value);
- if (val_quoted) {
- res = g_snprintf(p, len, "%s:%s;", key, val_quoted);
- g_free (val_quoted);
+ Glib::ustring val_quoted = css2_escape_quote(val->value);
+ if (~val_quoted.empty()) {
+ res = g_snprintf(p, len, "%s:%s;", key, val_quoted.c_str());
}
}
}
@@ -4710,8 +4709,7 @@ attribute_unquote(gchar const *val)
/**
* Quote and/or escape string for writing to CSS (style=). Returned value must be g_free'd.
*/
-gchar *
-css2_escape_quote(gchar const *val) {
+Glib::ustring css2_escape_quote(gchar const *val) {
Glib::ustring t;
bool quote = false;
@@ -4755,7 +4753,7 @@ css2_escape_quote(gchar const *val) {
t.push_back('\'');
}
- return (t.empty() ? NULL : g_strdup (t.c_str()));
+ return t;
}
/*