aboutsummaryrefslogtreecommitdiffstats
path: root/src/serdi.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-05-29 18:34:09 -0400
committerDavid Robillard <d@drobilla.net>2016-05-29 18:34:09 -0400
commit8f7cac4752d427f833969d316542d7a82b4602ea (patch)
tree27dcc29cbca11aee2127ddcdc71a246fbed077e9 /src/serdi.c
parent78e55b937ce347eef6387499ddd91d06d73e3a7c (diff)
downloadserd-8f7cac4752d427f833969d316542d7a82b4602ea.tar.gz
serd-8f7cac4752d427f833969d316542d7a82b4602ea.tar.bz2
serd-8f7cac4752d427f833969d316542d7a82b4602ea.zip
Fix handling of file I/O errors
Diffstat (limited to 'src/serdi.c')
-rw-r--r--src/serdi.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/serdi.c b/src/serdi.c
index 2054470e..9332519b 100644
--- a/src/serdi.c
+++ b/src/serdi.c
@@ -252,15 +252,19 @@ main(int argc, char** argv)
}
serd_reader_free(reader);
+ serd_writer_finish(writer);
+ serd_writer_free(writer);
+ serd_env_free(env);
+ serd_node_free(&base);
if (from_file) {
fclose(in_fd);
}
- serd_writer_finish(writer);
- serd_writer_free(writer);
- serd_env_free(env);
- serd_node_free(&base);
+ if (fclose(out_fd)) {
+ perror("serdi: write error");
+ status = SERD_ERR_UNKNOWN;
+ }
return (status > SERD_FAILURE) ? 1 : 0;
}