summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-09-01 01:36:28 +0000
committerDavid Robillard <d@drobilla.net>2011-09-01 01:36:28 +0000
commite925b68ca003e9370776b306b78b659153be57eb (patch)
tree732980476f79883aa9327f88361d3815a81da744
parent512206ee20d7f437f5ed60adb91b312f0ece851b (diff)
downloadsord-e925b68ca003e9370776b306b78b659153be57eb.tar.gz
sord-e925b68ca003e9370776b306b78b659153be57eb.tar.bz2
sord-e925b68ca003e9370776b306b78b659153be57eb.zip
Don't leak open file descriptors in Model::write_to_file (which was causing empty files to be written).
git-svn-id: http://svn.drobilla.net/sord/trunk@159 3d64ff67-21c5-427c-a301-fe4f08042e5a
-rw-r--r--sord/sordmm.hpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/sord/sordmm.hpp b/sord/sordmm.hpp
index 1b5a874..69796ae 100644
--- a/sord/sordmm.hpp
+++ b/sord/sordmm.hpp
@@ -504,6 +504,7 @@ Model::write_to_file(const std::string& uri, SerdSyntax syntax, SerdStyle style)
SerdURI base_uri = SERD_URI_NULL;
if (serd_uri_parse((const uint8_t*)uri.c_str(), &base_uri)) {
fprintf(stderr, "Invalid base URI <%s>\n", uri.c_str());
+ fclose(fd);
return SERD_ERR_BAD_ARG;
}
@@ -520,6 +521,7 @@ Model::write_to_file(const std::string& uri, SerdSyntax syntax, SerdStyle style)
sord_write(_c_obj, writer, 0);
serd_writer_free(writer);
+ fclose(fd);
return SERD_SUCCESS;
}