summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Horak <jhorak@redhat.com>2018-10-16 08:39:26 +0000
committerJan Horak <jhorak@redhat.com>2018-10-16 08:39:26 +0000
commitab0a68021ab4936c12d874997db580963d0e787b (patch)
tree153f51731e1a6fc5c97cba6c43ea2142857ab2cb /src
parentfix vi modelines: encoding -> fileencoding (diff)
downloadinkscape-ab0a68021ab4936c12d874997db580963d0e787b.tar.gz
inkscape-ab0a68021ab4936c12d874997db580963d0e787b.zip
Fix use after free in error reporting
Diffstat (limited to 'src')
-rw-r--r--src/io/uristream.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/io/uristream.cpp b/src/io/uristream.cpp
index ff4cca74d..9fd0d9c96 100644
--- a/src/io/uristream.cpp
+++ b/src/io/uristream.cpp
@@ -321,11 +321,14 @@ UriOutputStream::UriOutputStream(Inkscape::URI &destination)
//printf("out path:'%s'\n", cpath);
outf = fopen_utf8name(cpath, FILE_WRITE);
//outf = fopen(cpath, "wb");
- g_free(cpath);
+
if (!outf) {
Glib::ustring err = "UriOutputStream cannot open file ";
err += cpath;
+ g_free(cpath);
throw StreamException(err);
+ } else {
+ g_free(cpath);
}
break;