diff options
| author | Kris De Gussem <kris.degussem@gmail.com> | 2012-04-04 18:14:59 +0000 |
|---|---|---|
| committer | Kris <Kris.De.Gussem@hotmail.com> | 2012-04-04 18:14:59 +0000 |
| commit | ca99e4b3f7e4c70921f6c5fe8c2f0ae192b73ea6 (patch) | |
| tree | a9a41237e6a2c324d75f556ec032fba620016830 /src | |
| parent | gradient chemistry: fix null pointer dereference (diff) | |
| download | inkscape-ca99e4b3f7e4c70921f6c5fe8c2f0ae192b73ea6.tar.gz inkscape-ca99e4b3f7e4c70921f6c5fe8c2f0ae192b73ea6.zip | |
png export dialog: memory leak fix
(bzr r11148)
Diffstat (limited to 'src')
| -rw-r--r-- | src/ui/dialog/export.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index 3068a2de7..649645aff 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -976,6 +976,16 @@ void Export::onExport () gchar const *filename = g_strdup(filename_entry.get_text().c_str()); + if (filename == NULL){ + sp_ui_error_dialog(_("You have to enter a filename")); + return; + } + if(*filename == '\0') { + g_free (const_cast<gchar*>(filename)); + sp_ui_error_dialog(_("You have to enter a filename")); + return; + } + float const x0 = getValuePx(x0_adj); float const y0 = getValuePx(y0_adj); float const x1 = getValuePx(x1_adj); @@ -985,19 +995,14 @@ void Export::onExport () unsigned long int const width = int(getValue(bmwidth_adj) + 0.5); unsigned long int const height = int(getValue(bmheight_adj) + 0.5); - if (filename == NULL || *filename == '\0') { - sp_ui_error_dialog(_("You have to enter a filename")); - return; - } - if (!((x1 > x0) && (y1 > y0) && (width > 0) && (height > 0))) { + g_free (const_cast<gchar*>(filename)); sp_ui_error_dialog (_("The chosen area to be exported is invalid")); return; } // make sure that .png is the extension of the file: gchar * filename_ext = filename_add_extension(filename, "png"); - //gtk_entry_set_text(GTK_ENTRY(filename_entry), filename_ext); filename_entry.set_text(filename_ext); gchar *path = absolutize_path_from_document_location(doc, filename_ext); @@ -1131,6 +1136,7 @@ void Export::onExport () break; } + g_free (const_cast<gchar*>(filename)); g_free (filename_ext); g_free (path); |
