diff options
author | David Robillard <d@drobilla.net> | 2016-06-13 12:42:31 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2016-06-13 12:42:31 -0400 |
commit | c7715b8b5ee48297c9a4fc0831556921d5f78fb0 (patch) | |
tree | 461990ee9bc37f87588ed6c46682fee49b86cbeb /src | |
parent | 8f7cac4752d427f833969d316542d7a82b4602ea (diff) | |
download | serd-c7715b8b5ee48297c9a4fc0831556921d5f78fb0.tar.gz serd-c7715b8b5ee48297c9a4fc0831556921d5f78fb0.tar.bz2 serd-c7715b8b5ee48297c9a4fc0831556921d5f78fb0.zip |
Fix use of uninitialized fields
Fixes #1135
Diffstat (limited to 'src')
-rw-r--r-- | src/reader.c | 17 | ||||
-rw-r--r-- | src/writer.c | 9 |
2 files changed, 2 insertions, 24 deletions
diff --git a/src/reader.c b/src/reader.c index 5465dba6..b85284cd 100644 --- a/src/reader.c +++ b/src/reader.c @@ -1493,33 +1493,18 @@ serd_reader_new(SerdSyntax syntax, SerdEndSink end_sink) { const Cursor cur = { NULL, 0, 0 }; - SerdReader* me = (SerdReader*)malloc(sizeof(struct SerdReaderImpl)); + SerdReader* me = (SerdReader*)calloc(1, sizeof(SerdReader)); me->handle = handle; me->free_handle = free_handle; me->base_sink = base_sink; me->prefix_sink = prefix_sink; me->statement_sink = statement_sink; me->end_sink = end_sink; - me->error_sink = NULL; - me->error_handle = NULL; me->default_graph = SERD_NODE_NULL; - me->fd = 0; me->stack = serd_stack_new(SERD_PAGE_SIZE); me->syntax = syntax; me->cur = cur; - me->bprefix = NULL; - me->bprefix_len = 0; me->next_id = 1; - me->read_buf = 0; - me->file_buf = 0; - me->read_head = 0; - me->strict = false; - me->eof = false; - me->seen_genid = false; -#ifdef SERD_STACK_CHECK - me->allocs = 0; - me->n_allocs = 0; -#endif me->rdf_first = push_node(me, SERD_URI, NS_RDF "first", 48); me->rdf_rest = push_node(me, SERD_URI, NS_RDF "rest", 47); diff --git a/src/writer.c b/src/writer.c index a037bf81..954b9b5c 100644 --- a/src/writer.c +++ b/src/writer.c @@ -799,7 +799,7 @@ serd_writer_new(SerdSyntax syntax, void* stream) { const WriteContext context = WRITE_CONTEXT_NULL; - SerdWriter* writer = (SerdWriter*)malloc(sizeof(SerdWriter)); + SerdWriter* writer = (SerdWriter*)calloc(1, sizeof(SerdWriter)); writer->syntax = syntax; writer->style = style; writer->env = env; @@ -809,15 +809,8 @@ serd_writer_new(SerdSyntax syntax, writer->anon_stack = serd_stack_new(sizeof(WriteContext)); writer->sink = ssink; writer->stream = stream; - writer->error_sink = NULL; - writer->error_handle = NULL; writer->context = context; writer->list_subj = SERD_NODE_NULL; - writer->list_depth = 0; - writer->bprefix = NULL; - writer->bprefix_len = 0; - writer->indent = 0; - writer->last_sep = SEP_NONE; writer->empty = true; if (style & SERD_STYLE_BULK) { writer->bulk_sink = serd_bulk_sink_new(ssink, stream, SERD_PAGE_SIZE); |