serd-0.32.6-1.fc44

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-476): [#def1]
serd-0.32.6/src/base64.c:91:3: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘out’
serd-0.32.6/src/base64.c:98:1: enter_function: entry to ‘serd_base64_decode’
serd-0.32.6/src/base64.c:105:15: acquire_memory: this call could return NULL
serd-0.32.6/src/base64.c:108:29: branch_true: following ‘true’ branch (when ‘i < len’)...
serd-0.32.6/src/base64.c:109:13: branch_true: ...to here
serd-0.32.6/src/base64.c:111:12: branch_true: following ‘true’ branch...
serd-0.32.6/src/base64.c:111:12: branch_true: ...to here
serd-0.32.6/src/base64.c:112:14: branch_true: following ‘true’ branch...
serd-0.32.6/src/base64.c:111:12: branch_true: following ‘true’ branch...
serd-0.32.6/src/base64.c:111:12: branch_true: ...to here
serd-0.32.6/src/base64.c:112:14: branch_true: following ‘true’ branch...
serd-0.32.6/src/base64.c:111:12: branch_false: following ‘false’ branch...
serd-0.32.6/src/base64.c:119:8: branch_false: ...to here
serd-0.32.6/src/base64.c:119:8: branch_true: following ‘true’ branch (when ‘n_in > 1’)...
serd-0.32.6/src/base64.c:120:16: branch_true: ...to here
serd-0.32.6/src/base64.c:120:16: call_function: calling ‘decode_chunk’ from ‘serd_base64_decode’
#   89|   decode_chunk(const uint8_t in[4], uint8_t out[3])
#   90|   {
#   91|->   out[0] = (uint8_t)(((unmap(in[0]) << 2)) | unmap(in[1]) >> 4);
#   92|     out[1] = (uint8_t)(((unmap(in[1]) << 4) & 0xF0) | unmap(in[2]) >> 2);
#   93|     out[2] = (uint8_t)(((unmap(in[2]) << 6) & 0xC0) | unmap(in[3]));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def2]
serd-0.32.6/src/byte_sink.h:30:27: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’
serd-0.32.6/src/writer.c:1083:1: enter_function: entry to ‘serd_writer_new’
serd-0.32.6/src/writer.c:1101:24: call_function: inlined call to ‘serd_stack_new’ from ‘serd_writer_new’
serd-0.32.6/src/writer.c:1102:24: branch_true: following ‘true’ branch...
serd-0.32.6/src/writer.c:1102:24: call_function: inlined call to ‘serd_byte_sink_new’ from ‘serd_writer_new’
#   28|   
#   29|     if (block_size > 1) {
#   30|->     bsink.buf = (uint8_t*)serd_allocate_buffer(block_size);
#   31|     }
#   32|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def3]
serd-0.32.6/src/byte_sink.h:30:27: warning[-Wanalyzer-malloc-leak]: leak of ‘writer’
serd-0.32.6/src/writer.c:1083:1: enter_function: entry to ‘serd_writer_new’
serd-0.32.6/src/writer.c:1093:37: acquire_memory: allocated here
serd-0.32.6/src/writer.c:1102:24: branch_true: following ‘true’ branch...
serd-0.32.6/src/writer.c:1102:24: call_function: inlined call to ‘serd_byte_sink_new’ from ‘serd_writer_new’
#   28|   
#   29|     if (block_size > 1) {
#   30|->     bsink.buf = (uint8_t*)serd_allocate_buffer(block_size);
#   31|     }
#   32|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def4]
serd-0.32.6/src/env.c:78:5: warning[-Wanalyzer-malloc-leak]: leak of ‘env’
serd-0.32.6/src/env.c:26:1: enter_function: entry to ‘serd_env_new’
serd-0.32.6/src/env.c:28:28: acquire_memory: allocated here
serd-0.32.6/src/env.c:29:6: branch_true: following ‘true’ branch...
serd-0.32.6/src/env.c:30:9: call_function: calling ‘serd_env_set_base_uri’ from ‘serd_env_new’
#   76|   
#   77|     if (!uri || !uri->buf) {
#   78|->     serd_node_free(&env->base_uri_node);
#   79|       env->base_uri_node = SERD_NODE_NULL;
#   80|       env->base_uri      = SERD_URI_NULL;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def5]
serd-0.32.6/src/env.c:87:5: warning[-Wanalyzer-malloc-leak]: leak of ‘env’
serd-0.32.6/src/env.c:26:1: enter_function: entry to ‘serd_env_new’
serd-0.32.6/src/env.c:28:28: acquire_memory: allocated here
serd-0.32.6/src/env.c:29:6: branch_true: following ‘true’ branch...
serd-0.32.6/src/env.c:30:9: call_function: calling ‘serd_env_set_base_uri’ from ‘serd_env_new’
#   85|     SerdURI  base_uri;
#   86|     SerdNode base_uri_node =
#   87|->     serd_node_new_uri_from_node(uri, &env->base_uri, &base_uri);
#   88|   
#   89|     // Replace the current base URI

Error: GCC_ANALYZER_WARNING (CWE-401): [#def6]
serd-0.32.6/src/env.c:90:3: warning[-Wanalyzer-malloc-leak]: leak of ‘env’
serd-0.32.6/src/env.c:26:1: enter_function: entry to ‘serd_env_new’
serd-0.32.6/src/env.c:28:28: acquire_memory: allocated here
serd-0.32.6/src/env.c:29:6: branch_true: following ‘true’ branch...
serd-0.32.6/src/env.c:30:9: call_function: calling ‘serd_env_set_base_uri’ from ‘serd_env_new’
#   88|   
#   89|     // Replace the current base URI
#   90|->   serd_node_free(&env->base_uri_node);
#   91|     env->base_uri_node = base_uri_node;
#   92|     env->base_uri      = base_uri;

Error: CPPCHECK_WARNING (CWE-476): [#def7]
serd-0.32.6/src/node.c:92: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buf
#   90|     SerdNode copy = *node;
#   91|     uint8_t* buf  = (uint8_t*)malloc(copy.n_bytes + 1);
#   92|->   memcpy(buf, node->buf, copy.n_bytes + 1);
#   93|     copy.buf = buf;
#   94|     return copy;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def8]
serd-0.32.6/src/node.c:92:3: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘buf’ where non-null expected
serd-0.32.6/src/node.c:86:6: branch_false: following ‘false’ branch...
serd-0.32.6/src/node.c:91:29: acquire_memory: this call could return NULL
serd-0.32.6/src/node.c:92:3: danger: argument 1 (‘buf’) from [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2) could be NULL where non-null expected
#   90|     SerdNode copy = *node;
#   91|     uint8_t* buf  = (uint8_t*)malloc(copy.n_bytes + 1);
#   92|->   memcpy(buf, node->buf, copy.n_bytes + 1);
#   93|     copy.buf = buf;
#   94|     return copy;

Error: CPPCHECK_WARNING (CWE-476): [#def9]
serd-0.32.6/src/node.c:171: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: uri
#  169|       uri     = (uint8_t*)calloc(uri_len + 1, 1);
#  170|   
#  171|->     memcpy(uri, "file://", 7);
#  172|   
#  173|       if (hostname) {

Error: GCC_ANALYZER_WARNING (CWE-688): [#def10]
serd-0.32.6/src/node.c:171:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘uri’ where non-null expected
serd-0.32.6/src/node.c:169:25: acquire_memory: this call could return NULL
serd-0.32.6/src/node.c:171:5: danger: argument 1 (‘uri’) from [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0) could be NULL where non-null expected
#  169|       uri     = (uint8_t*)calloc(uri_len + 1, 1);
#  170|   
#  171|->     memcpy(uri, "file://", 7);
#  172|   
#  173|       if (hostname) {

Error: CPPCHECK_WARNING (CWE-682): [#def11]
serd-0.32.6/src/node.c:174: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
#  172|   
#  173|       if (hostname) {
#  174|->       memcpy(uri + 7, hostname, hostname_len);
#  175|       }
#  176|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def12]
serd-0.32.6/src/node.c:187:7: warning[-Wanalyzer-malloc-leak]: leak of ‘uri’
serd-0.32.6/src/node.c:169:25: acquire_memory: allocated here
serd-0.32.6/src/node.c:173:8: branch_false: following ‘false’ branch (when ‘hostname’ is NULL)...
serd-0.32.6/src/node.c:177:8: branch_false: ...to here
serd-0.32.6/src/node.c:177:8: branch_false: following ‘false’ branch...
serd-0.32.6/src/node.c:182:13: branch_false: ...to here
serd-0.32.6/src/node.c:183:22: branch_true: following ‘true’ branch (when ‘i < path_len’)...
serd-0.32.6/src/node.c:184:13: branch_true: ...to here
serd-0.32.6/src/node.c:184:8: branch_false: following ‘false’ branch...
serd-0.32.6/src/node.c:186:15: branch_false: ...to here
serd-0.32.6/src/node.c:187:7: throw: if ‘serd_chunk_sink’ throws an exception...
serd-0.32.6/src/node.c:187:7: danger: ‘uri’ leaks here; was allocated at [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#  185|         serd_chunk_sink("%%", 2, &chunk);
#  186|       } else if (!escape || is_uri_path_char(path[i])) {
#  187|->       serd_chunk_sink(path + i, 1, &chunk);
#  188|   #ifdef _WIN32
#  189|       } else if (path[i] == '\\') {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def13]
serd-0.32.6/src/node.c:199:33: warning[-Wanalyzer-malloc-leak]: leak of ‘uri’
serd-0.32.6/src/node.c:169:25: acquire_memory: allocated here
serd-0.32.6/src/node.c:173:8: branch_false: following ‘false’ branch (when ‘hostname’ is NULL)...
serd-0.32.6/src/node.c:177:8: branch_false: ...to here
serd-0.32.6/src/node.c:177:8: branch_false: following ‘false’ branch...
serd-0.32.6/src/node.c:182:13: branch_false: ...to here
serd-0.32.6/src/node.c:183:22: branch_false: following ‘false’ branch (when ‘i >= path_len’)...
serd-0.32.6/src/node.c:199:33: branch_false: ...to here
serd-0.32.6/src/node.c:199:33: throw: if ‘serd_chunk_sink_finish’ throws an exception...
serd-0.32.6/src/node.c:199:33: danger: ‘uri’ leaks here; was allocated at [(1)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/0)
#  197|     }
#  198|   
#  199|->   const uint8_t* const string = serd_chunk_sink_finish(&chunk);
#  200|   
#  201|     if (string && out) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def14]
serd-0.32.6/src/node.c:224:29: warning[-Wanalyzer-malloc-leak]: leak of ‘ptr’
serd-0.32.6/src/node.c:221:39: acquire_memory: allocated here
serd-0.32.6/src/node.c:224:29: throw: if ‘serd_uri_serialise’ throws an exception...
serd-0.32.6/src/node.c:224:29: danger: ‘ptr’ leaks here; was allocated at [(1)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/0)
#  222|     SerdNode     node       = {buf, 0, 0, 0, SERD_URI};
#  223|     uint8_t*     ptr        = buf;
#  224|->   const size_t actual_len = serd_uri_serialise(&abs_uri, string_sink, &ptr);
#  225|   
#  226|     buf[actual_len] = '\0';

Error: CPPCHECK_WARNING (CWE-476): [#def15]
serd-0.32.6/src/node.c:226: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buf
#  224|     const size_t actual_len = serd_uri_serialise(&abs_uri, string_sink, &ptr);
#  225|   
#  226|->   buf[actual_len] = '\0';
#  227|     node.n_bytes    = actual_len;
#  228|     node.n_chars    = serd_strlen(buf, NULL, NULL);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def16]
serd-0.32.6/src/node.c:251:5: warning[-Wanalyzer-malloc-leak]: leak of ‘ptr’
serd-0.32.6/src/node.c:247:37: acquire_memory: allocated here
serd-0.32.6/src/node.c:251:5: throw: if ‘serd_uri_serialise_relative’ throws an exception...
serd-0.32.6/src/node.c:251:5: danger: ‘ptr’ leaks here; was allocated at [(1)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/0)
#  249|     uint8_t*     ptr      = buf;
#  250|     const size_t actual_len =
#  251|->     serd_uri_serialise_relative(uri, base, root, string_sink, &ptr);
#  252|   
#  253|     buf[actual_len] = '\0';

Error: CPPCHECK_WARNING (CWE-476): [#def17]
serd-0.32.6/src/node.c:253: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buf
#  251|       serd_uri_serialise_relative(uri, base, root, string_sink, &ptr);
#  252|   
#  253|->   buf[actual_len] = '\0';
#  254|     node.n_bytes    = actual_len;
#  255|     node.n_chars    = serd_strlen(buf, NULL, NULL);

Error: CPPCHECK_WARNING (CWE-682): [#def18]
serd-0.32.6/src/node.c:285: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
#  283|   
#  284|     // Point s to decimal point location
#  285|->   char* s = buf + int_digits;
#  286|     if (d < 0.0) {
#  287|       *buf = '-';

Error: GCC_ANALYZER_WARNING (CWE-476): [#def19]
serd-0.32.6/src/node.c:287:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘buf’
serd-0.32.6/src/node.c:274:6: branch_false: following ‘false’ branch (when ‘d ord d’)...
serd-0.32.6/src/node.c:274:19: branch_false: ...to here
serd-0.32.6/src/node.c:274:7: branch_true: following ‘true’ branch...
serd-0.32.6/src/node.c:279:31: branch_true: ...to here
serd-0.32.6/src/node.c:280:38: acquire_memory: this call could return NULL
serd-0.32.6/src/node.c:286:6: branch_true: following ‘true’ branch (when ‘d < 0.0’)...
serd-0.32.6/src/node.c:287:5: branch_true: ...to here
serd-0.32.6/src/node.c:287:5: danger: ‘buf’ could be NULL: unchecked value from [(5)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/4)
#  285|     char* s = buf + int_digits;
#  286|     if (d < 0.0) {
#  287|->     *buf = '-';
#  288|       ++s;
#  289|     }

Error: CPPCHECK_WARNING (CWE-682): [#def20]
serd-0.32.6/src/node.c:335: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
#  333|   
#  334|     // Point s to the end
#  335|->   char* s = buf + digits - 1;
#  336|     if (i < 0) {
#  337|       *buf = '-';

Error: CPPCHECK_WARNING (CWE-476): [#def21]
serd-0.32.6/src/node.c:337: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buf
#  335|     char* s = buf + digits - 1;
#  336|     if (i < 0) {
#  337|->     *buf = '-';
#  338|       ++s;
#  339|     }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def22]
serd-0.32.6/src/node.c:337:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘buf’
serd-0.32.6/src/node.c:329:27: branch_true: following ‘true’ branch (when ‘i < 0’)...
serd-0.32.6/src/node.c:329:37: branch_true: ...to here
serd-0.32.6/src/node.c:331:34: acquire_memory: this call could return NULL
serd-0.32.6/src/node.c:336:6: branch_true: following ‘true’ branch (when ‘i < 0’)...
serd-0.32.6/src/node.c:337:5: branch_true: ...to here
serd-0.32.6/src/node.c:337:5: danger: ‘buf’ could be NULL: unchecked value from [(3)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/2)
#  335|     char* s = buf + digits - 1;
#  336|     if (i < 0) {
#  337|->     *buf = '-';
#  338|       ++s;
#  339|     }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def23]
serd-0.32.6/src/node.c:362:7: warning[-Wanalyzer-malloc-leak]: leak of ‘str’
serd-0.32.6/src/node.c:359:33: acquire_memory: allocated here
serd-0.32.6/src/node.c:362:7: throw: if ‘serd_base64_encode’ throws an exception...
serd-0.32.6/src/node.c:362:7: danger: ‘str’ leaks here; was allocated at [(1)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/0)
#  360|     SerdNode     node = {str, len, len, 0, SERD_LITERAL};
#  361|   
#  362|->   if (serd_base64_encode(str, buf, size, wrap_lines)) {
#  363|       node.flags |= SERD_HAS_NEWLINE;
#  364|     }

Error: CPPCHECK_WARNING (CWE-476): [#def24]
serd-0.32.6/src/reader.c:105: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: reader
#  103|     memcpy(buf, str, n_bytes + 1);
#  104|   
#  105|->   const Ref ref = (Ref)((uint8_t*)node - reader->stack.buf);
#  106|   
#  107|   #ifdef SERD_STACK_CHECK

Error: CPPCHECK_WARNING (CWE-476): [#def25]
serd-0.32.6/src/reader.c:206: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: me
#  204|   {
#  205|     SerdReader* me     = (SerdReader*)calloc(1, sizeof(SerdReader));
#  206|->   me->handle         = handle;
#  207|     me->free_handle    = free_handle;
#  208|     me->base_sink      = base_sink;

Error: CPPCHECK_WARNING (CWE-476): [#def26]
serd-0.32.6/src/reader.c:207: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: me
#  205|     SerdReader* me     = (SerdReader*)calloc(1, sizeof(SerdReader));
#  206|     me->handle         = handle;
#  207|->   me->free_handle    = free_handle;
#  208|     me->base_sink      = base_sink;
#  209|     me->prefix_sink    = prefix_sink;

Error: CPPCHECK_WARNING (CWE-476): [#def27]
serd-0.32.6/src/reader.c:208: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: me
#  206|     me->handle         = handle;
#  207|     me->free_handle    = free_handle;
#  208|->   me->base_sink      = base_sink;
#  209|     me->prefix_sink    = prefix_sink;
#  210|     me->statement_sink = statement_sink;

Error: CPPCHECK_WARNING (CWE-476): [#def28]
serd-0.32.6/src/reader.c:209: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: me
#  207|     me->free_handle    = free_handle;
#  208|     me->base_sink      = base_sink;
#  209|->   me->prefix_sink    = prefix_sink;
#  210|     me->statement_sink = statement_sink;
#  211|     me->end_sink       = end_sink;

Error: CPPCHECK_WARNING (CWE-476): [#def29]
serd-0.32.6/src/reader.c:210: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: me
#  208|     me->base_sink      = base_sink;
#  209|     me->prefix_sink    = prefix_sink;
#  210|->   me->statement_sink = statement_sink;
#  211|     me->end_sink       = end_sink;
#  212|     me->default_graph  = SERD_NODE_NULL;

Error: CPPCHECK_WARNING (CWE-476): [#def30]
serd-0.32.6/src/reader.c:211: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: me
#  209|     me->prefix_sink    = prefix_sink;
#  210|     me->statement_sink = statement_sink;
#  211|->   me->end_sink       = end_sink;
#  212|     me->default_graph  = SERD_NODE_NULL;
#  213|     me->stack          = serd_stack_new(SERD_PAGE_SIZE);

Error: CPPCHECK_WARNING (CWE-476): [#def31]
serd-0.32.6/src/reader.c:212: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: me
#  210|     me->statement_sink = statement_sink;
#  211|     me->end_sink       = end_sink;
#  212|->   me->default_graph  = SERD_NODE_NULL;
#  213|     me->stack          = serd_stack_new(SERD_PAGE_SIZE);
#  214|     me->syntax         = syntax;

Error: CPPCHECK_WARNING (CWE-476): [#def32]
serd-0.32.6/src/reader.c:213: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: me
#  211|     me->end_sink       = end_sink;
#  212|     me->default_graph  = SERD_NODE_NULL;
#  213|->   me->stack          = serd_stack_new(SERD_PAGE_SIZE);
#  214|     me->syntax         = syntax;
#  215|     me->next_id        = 1;

Error: CPPCHECK_WARNING (CWE-476): [#def33]
serd-0.32.6/src/reader.c:214: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: me
#  212|     me->default_graph  = SERD_NODE_NULL;
#  213|     me->stack          = serd_stack_new(SERD_PAGE_SIZE);
#  214|->   me->syntax         = syntax;
#  215|     me->next_id        = 1;
#  216|     me->strict         = true;

Error: CPPCHECK_WARNING (CWE-476): [#def34]
serd-0.32.6/src/reader.c:215: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: me
#  213|     me->stack          = serd_stack_new(SERD_PAGE_SIZE);
#  214|     me->syntax         = syntax;
#  215|->   me->next_id        = 1;
#  216|     me->strict         = true;
#  217|   

Error: CPPCHECK_WARNING (CWE-476): [#def35]
serd-0.32.6/src/reader.c:216: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: me
#  214|     me->syntax         = syntax;
#  215|     me->next_id        = 1;
#  216|->   me->strict         = true;
#  217|   
#  218|     me->rdf_first = push_node(me, SERD_URI, NS_RDF "first", 48);

Error: CPPCHECK_WARNING (CWE-476): [#def36]
serd-0.32.6/src/reader.c:218: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: me
#  216|     me->strict         = true;
#  217|   
#  218|->   me->rdf_first = push_node(me, SERD_URI, NS_RDF "first", 48);
#  219|     me->rdf_rest  = push_node(me, SERD_URI, NS_RDF "rest", 47);
#  220|     me->rdf_nil   = push_node(me, SERD_URI, NS_RDF "nil", 46);

Error: CPPCHECK_WARNING (CWE-476): [#def37]
serd-0.32.6/src/reader.c:219: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: me
#  217|   
#  218|     me->rdf_first = push_node(me, SERD_URI, NS_RDF "first", 48);
#  219|->   me->rdf_rest  = push_node(me, SERD_URI, NS_RDF "rest", 47);
#  220|     me->rdf_nil   = push_node(me, SERD_URI, NS_RDF "nil", 46);
#  221|   

Error: CPPCHECK_WARNING (CWE-476): [#def38]
serd-0.32.6/src/reader.c:220: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: me
#  218|     me->rdf_first = push_node(me, SERD_URI, NS_RDF "first", 48);
#  219|     me->rdf_rest  = push_node(me, SERD_URI, NS_RDF "rest", 47);
#  220|->   me->rdf_nil   = push_node(me, SERD_URI, NS_RDF "nil", 46);
#  221|   
#  222|     return me;

Error: GCC_ANALYZER_WARNING (CWE-404): [#def39]
serd-0.32.6/src/serd_internal.h:28:5: warning[-Wanalyzer-va-list-leak]: missing call to ‘va_end’
serd-0.32.6/src/reader.c:462:1: enter_function: entry to ‘serd_reader_read_string’
serd-0.32.6/src/reader.c:469:19: call_function: calling ‘serd_reader_prepare’ from ‘serd_reader_read_string’
#   26|   {
#   27|     if (error_sink) {
#   28|->     error_sink(handle, e);
#   29|     } else {
#   30|       fprintf(stderr, "error: %s:%u:%u: ", e->filename, e->line, e->col);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def40]
serd-0.32.6/src/serdi.c:324:7: warning[-Wanalyzer-file-leak]: leak of FILE ‘in_fd’
serd-0.32.6/src/serdi.c:178:1: enter_function: entry to ‘main’
serd-0.32.6/src/serdi.c:281:6: branch_false: following ‘false’ branch (when ‘a != argc’)...
serd-0.32.6/src/serdi.c:292:52: branch_false: ...to here
serd-0.32.6/src/serdi.c:293:6: branch_true: following ‘true’ branch (when ‘from_file != 0’)...
serd-0.32.6/src/serdi.c:294:15: branch_true: ...to here
serd-0.32.6/src/serdi.c:294:15: branch_false: following ‘false’ branch (when ‘in_name’ is NULL)...
serd-0.32.6/src/serdi.c:294:15: branch_false: ...to here
serd-0.32.6/src/serdi.c:295:8: branch_true: following ‘true’ branch (when ‘in_fd’ is NULL)...
serd-0.32.6/src/serdi.c:296:12: branch_true: ...to here
serd-0.32.6/src/serdi.c:296:10: branch_false: following ‘false’ branch...
serd-0.32.6/src/serdi.c:300:31: branch_false: ...to here
serd-0.32.6/src/serdi.c:300:31: call_function: calling ‘serd_fopen’ from ‘main’
serd-0.32.6/src/serdi.c:300:31: return_function: returning to ‘main’ from ‘serd_fopen’
serd-0.32.6/src/serdi.c:300:11: branch_false: following ‘false’ branch...
serd-0.32.6/src/serdi.c:306:6: branch_false: ...to here
serd-0.32.6/src/serdi.c:306:6: branch_true: following ‘true’ branch (when ‘input_syntax == 0’)...
serd-0.32.6/src/serdi.c:306:41: branch_true: ...to here
serd-0.32.6/src/serdi.c:306:41: call_function: calling ‘guess_syntax’ from ‘main’
serd-0.32.6/src/serdi.c:306:41: return_function: returning to ‘main’ from ‘guess_syntax’
serd-0.32.6/src/serdi.c:306:7: branch_true: following ‘true’ branch...
serd-0.32.6/src/serdi.c:306:7: branch_true: ...to here
serd-0.32.6/src/serdi.c:310:6: branch_true: following ‘true’ branch (when ‘output_syntax == 0’)...
serd-0.32.6/src/serdi.c:312:8: branch_true: ...to here
serd-0.32.6/src/serdi.c:312:7: branch_false: following ‘false’ branch...
serd-0.32.6/src/serdi.c:312:7: branch_false: ...to here
serd-0.32.6/src/serdi.c:317:34: call_function: calling ‘choose_style’ from ‘main’
serd-0.32.6/src/serdi.c:317:34: return_function: returning to ‘main’ from ‘choose_style’
serd-0.32.6/src/serdi.c:322:6: branch_true: following ‘true’ branch (when ‘argc > a’)...
serd-0.32.6/src/serdi.c:324:57: branch_true: ...to here
serd-0.32.6/src/serdi.c:324:7: throw: if ‘serd_node_new_uri_from_string’ throws an exception...
serd-0.32.6/src/serdi.c:324:7: danger: ‘in_fd’ leaks here; was opened at [(14)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/13)
#  322|     if (a < argc) { // Base URI given on command line
#  323|       base =
#  324|->       serd_node_new_uri_from_string((const uint8_t*)argv[a], NULL, &base_uri);
#  325|     } else if (from_file && in_fd != stdin) { // Use input file URI
#  326|       base = serd_node_new_file_uri(input, NULL, &base_uri, true);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def41]
serd-0.32.6/src/serdi.c:324:7: warning[-Wanalyzer-malloc-leak]: leak of ‘in_fd’
serd-0.32.6/src/serdi.c:178:1: enter_function: entry to ‘main’
serd-0.32.6/src/serdi.c:281:6: branch_false: following ‘false’ branch (when ‘a != argc’)...
serd-0.32.6/src/serdi.c:292:52: branch_false: ...to here
serd-0.32.6/src/serdi.c:293:6: branch_true: following ‘true’ branch (when ‘from_file != 0’)...
serd-0.32.6/src/serdi.c:294:15: branch_true: ...to here
serd-0.32.6/src/serdi.c:294:15: branch_false: following ‘false’ branch (when ‘in_name’ is NULL)...
serd-0.32.6/src/serdi.c:294:15: branch_false: ...to here
serd-0.32.6/src/serdi.c:295:8: branch_true: following ‘true’ branch (when ‘in_fd’ is NULL)...
serd-0.32.6/src/serdi.c:296:12: branch_true: ...to here
serd-0.32.6/src/serdi.c:296:10: branch_false: following ‘false’ branch...
serd-0.32.6/src/serdi.c:300:31: branch_false: ...to here
serd-0.32.6/src/serdi.c:300:31: call_function: calling ‘serd_fopen’ from ‘main’
serd-0.32.6/src/serdi.c:300:31: return_function: returning to ‘main’ from ‘serd_fopen’
serd-0.32.6/src/serdi.c:300:11: branch_false: following ‘false’ branch...
serd-0.32.6/src/serdi.c:306:6: branch_false: ...to here
serd-0.32.6/src/serdi.c:306:6: branch_true: following ‘true’ branch (when ‘input_syntax == 0’)...
serd-0.32.6/src/serdi.c:306:41: branch_true: ...to here
serd-0.32.6/src/serdi.c:306:41: call_function: calling ‘guess_syntax’ from ‘main’
serd-0.32.6/src/serdi.c:306:41: return_function: returning to ‘main’ from ‘guess_syntax’
serd-0.32.6/src/serdi.c:306:7: branch_true: following ‘true’ branch...
serd-0.32.6/src/serdi.c:306:7: branch_true: ...to here
serd-0.32.6/src/serdi.c:310:6: branch_true: following ‘true’ branch (when ‘output_syntax == 0’)...
serd-0.32.6/src/serdi.c:312:8: branch_true: ...to here
serd-0.32.6/src/serdi.c:312:7: branch_false: following ‘false’ branch...
serd-0.32.6/src/serdi.c:312:7: branch_false: ...to here
serd-0.32.6/src/serdi.c:317:34: call_function: calling ‘choose_style’ from ‘main’
serd-0.32.6/src/serdi.c:317:34: return_function: returning to ‘main’ from ‘choose_style’
serd-0.32.6/src/serdi.c:322:6: branch_true: following ‘true’ branch (when ‘argc > a’)...
serd-0.32.6/src/serdi.c:324:57: branch_true: ...to here
serd-0.32.6/src/serdi.c:324:7: throw: if ‘serd_node_new_uri_from_string’ throws an exception...
serd-0.32.6/src/serdi.c:324:7: danger: ‘in_fd’ leaks here; was allocated at [(14)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/13)
#  322|     if (a < argc) { // Base URI given on command line
#  323|       base =
#  324|->       serd_node_new_uri_from_string((const uint8_t*)argv[a], NULL, &base_uri);
#  325|     } else if (from_file && in_fd != stdin) { // Use input file URI
#  326|       base = serd_node_new_file_uri(input, NULL, &base_uri, true);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def42]
serd-0.32.6/src/serdi.c:326:12: warning[-Wanalyzer-file-leak]: leak of FILE ‘in_fd’
serd-0.32.6/src/serdi.c:178:1: enter_function: entry to ‘main’
serd-0.32.6/src/serdi.c:281:6: branch_false: following ‘false’ branch (when ‘a != argc’)...
serd-0.32.6/src/serdi.c:292:52: branch_false: ...to here
serd-0.32.6/src/serdi.c:293:6: branch_true: following ‘true’ branch (when ‘from_file != 0’)...
serd-0.32.6/src/serdi.c:294:15: branch_true: ...to here
serd-0.32.6/src/serdi.c:294:15: branch_false: following ‘false’ branch (when ‘in_name’ is NULL)...
serd-0.32.6/src/serdi.c:294:15: branch_false: ...to here
serd-0.32.6/src/serdi.c:295:8: branch_true: following ‘true’ branch (when ‘in_fd’ is NULL)...
serd-0.32.6/src/serdi.c:296:12: branch_true: ...to here
serd-0.32.6/src/serdi.c:296:10: branch_false: following ‘false’ branch...
serd-0.32.6/src/serdi.c:300:31: branch_false: ...to here
serd-0.32.6/src/serdi.c:300:31: call_function: calling ‘serd_fopen’ from ‘main’
serd-0.32.6/src/serdi.c:300:31: return_function: returning to ‘main’ from ‘serd_fopen’
serd-0.32.6/src/serdi.c:300:11: branch_false: following ‘false’ branch...
serd-0.32.6/src/serdi.c:306:6: branch_false: ...to here
serd-0.32.6/src/serdi.c:306:6: branch_true: following ‘true’ branch (when ‘input_syntax == 0’)...
serd-0.32.6/src/serdi.c:306:41: branch_true: ...to here
serd-0.32.6/src/serdi.c:306:41: call_function: calling ‘guess_syntax’ from ‘main’
serd-0.32.6/src/serdi.c:306:41: return_function: returning to ‘main’ from ‘guess_syntax’
serd-0.32.6/src/serdi.c:306:7: branch_true: following ‘true’ branch...
serd-0.32.6/src/serdi.c:306:7: branch_true: ...to here
serd-0.32.6/src/serdi.c:310:6: branch_true: following ‘true’ branch (when ‘output_syntax == 0’)...
serd-0.32.6/src/serdi.c:312:8: branch_true: ...to here
serd-0.32.6/src/serdi.c:312:7: branch_false: following ‘false’ branch...
serd-0.32.6/src/serdi.c:312:7: branch_false: ...to here
serd-0.32.6/src/serdi.c:317:34: call_function: calling ‘choose_style’ from ‘main’
serd-0.32.6/src/serdi.c:317:34: return_function: returning to ‘main’ from ‘choose_style’
serd-0.32.6/src/serdi.c:322:6: branch_false: following ‘false’ branch (when ‘argc <= a’)...
serd-0.32.6/src/serdi.c:325:13: branch_false: ...to here
serd-0.32.6/src/serdi.c:325:13: branch_true: following ‘true’ branch...
serd-0.32.6/src/serdi.c:326:12: throw: if ‘serd_node_new_file_uri’ throws an exception...
serd-0.32.6/src/serdi.c:326:12: danger: ‘in_fd’ leaks here; was opened at [(14)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/13)
#  324|         serd_node_new_uri_from_string((const uint8_t*)argv[a], NULL, &base_uri);
#  325|     } else if (from_file && in_fd != stdin) { // Use input file URI
#  326|->     base = serd_node_new_file_uri(input, NULL, &base_uri, true);
#  327|     }
#  328|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def43]
serd-0.32.6/src/serdi.c:326:12: warning[-Wanalyzer-malloc-leak]: leak of ‘in_fd’
serd-0.32.6/src/serdi.c:178:1: enter_function: entry to ‘main’
serd-0.32.6/src/serdi.c:281:6: branch_false: following ‘false’ branch (when ‘a != argc’)...
serd-0.32.6/src/serdi.c:292:52: branch_false: ...to here
serd-0.32.6/src/serdi.c:293:6: branch_true: following ‘true’ branch (when ‘from_file != 0’)...
serd-0.32.6/src/serdi.c:294:15: branch_true: ...to here
serd-0.32.6/src/serdi.c:294:15: branch_false: following ‘false’ branch (when ‘in_name’ is NULL)...
serd-0.32.6/src/serdi.c:294:15: branch_false: ...to here
serd-0.32.6/src/serdi.c:295:8: branch_true: following ‘true’ branch (when ‘in_fd’ is NULL)...
serd-0.32.6/src/serdi.c:296:12: branch_true: ...to here
serd-0.32.6/src/serdi.c:296:10: branch_false: following ‘false’ branch...
serd-0.32.6/src/serdi.c:300:31: branch_false: ...to here
serd-0.32.6/src/serdi.c:300:31: call_function: calling ‘serd_fopen’ from ‘main’
serd-0.32.6/src/serdi.c:300:31: return_function: returning to ‘main’ from ‘serd_fopen’
serd-0.32.6/src/serdi.c:300:11: branch_false: following ‘false’ branch...
serd-0.32.6/src/serdi.c:306:6: branch_false: ...to here
serd-0.32.6/src/serdi.c:306:6: branch_true: following ‘true’ branch (when ‘input_syntax == 0’)...
serd-0.32.6/src/serdi.c:306:41: branch_true: ...to here
serd-0.32.6/src/serdi.c:306:41: call_function: calling ‘guess_syntax’ from ‘main’
serd-0.32.6/src/serdi.c:306:41: return_function: returning to ‘main’ from ‘guess_syntax’
serd-0.32.6/src/serdi.c:306:7: branch_true: following ‘true’ branch...
serd-0.32.6/src/serdi.c:306:7: branch_true: ...to here
serd-0.32.6/src/serdi.c:310:6: branch_true: following ‘true’ branch (when ‘output_syntax == 0’)...
serd-0.32.6/src/serdi.c:312:8: branch_true: ...to here
serd-0.32.6/src/serdi.c:312:7: branch_false: following ‘false’ branch...
serd-0.32.6/src/serdi.c:312:7: branch_false: ...to here
serd-0.32.6/src/serdi.c:317:34: call_function: calling ‘choose_style’ from ‘main’
serd-0.32.6/src/serdi.c:317:34: return_function: returning to ‘main’ from ‘choose_style’
serd-0.32.6/src/serdi.c:322:6: branch_false: following ‘false’ branch (when ‘argc <= a’)...
serd-0.32.6/src/serdi.c:325:13: branch_false: ...to here
serd-0.32.6/src/serdi.c:325:13: branch_true: following ‘true’ branch...
serd-0.32.6/src/serdi.c:326:12: throw: if ‘serd_node_new_file_uri’ throws an exception...
serd-0.32.6/src/serdi.c:326:12: danger: ‘in_fd’ leaks here; was allocated at [(14)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/13)
#  324|         serd_node_new_uri_from_string((const uint8_t*)argv[a], NULL, &base_uri);
#  325|     } else if (from_file && in_fd != stdin) { // Use input file URI
#  326|->     base = serd_node_new_file_uri(input, NULL, &base_uri, true);
#  327|     }
#  328|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def44]
serd-0.32.6/src/stack.h:54:5: warning[-Wanalyzer-malloc-leak]: leak of ‘*reader.stack.buf’
serd-0.32.6/src/n3.c:195:1: enter_function: entry to ‘read_utf8_character’
serd-0.32.6/src/n3.c:201:5: call_function: calling ‘push_bytes’ from ‘read_utf8_character’
#   52|     if (stack->buf_size < new_size) {
#   53|       stack->buf_size += (stack->buf_size >> 1); // *= 1.5
#   54|->     stack->buf = (uint8_t*)realloc(stack->buf, stack->buf_size);
#   55|     }
#   56|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def45]
serd-0.32.6/src/uri.c:65:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘*hostname’ where non-null expected
serd-0.32.6/src/uri.c:51:6: branch_true: following ‘true’ branch (when ‘hostname’ is non-NULL)...
serd-0.32.6/src/uri.c:52:5: branch_true: ...to here
serd-0.32.6/src/uri.c:54:6: branch_true: following ‘true’ branch...
serd-0.32.6/src/uri.c:55:20: branch_true: ...to here
serd-0.32.6/src/uri.c:56:8: branch_false: following ‘false’ branch...
serd-0.32.6/src/uri.c:59:36: branch_false: ...to here
serd-0.32.6/src/uri.c:59:10: branch_false: following ‘false’ branch (when ‘path’ is non-NULL)...
serd-0.32.6/src/uri.c:63:10: branch_false: ...to here
serd-0.32.6/src/uri.c:63:10: branch_true: following ‘true’ branch (when ‘hostname’ is non-NULL)...
serd-0.32.6/src/uri.c:64:47: branch_true: ...to here
serd-0.32.6/src/uri.c:64:31: acquire_memory: this call could return NULL
serd-0.32.6/src/uri.c:65:9: danger: argument 1 (‘calloc((long unsigned int)(path - auth + 1), 1)’) from [(12)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/11) could be NULL where non-null expected
#   63|         if (hostname) {
#   64|           *hostname = (uint8_t*)calloc((size_t)(path - auth + 1), 1);
#   65|->         memcpy(*hostname, auth, (size_t)(path - auth));
#   66|         }
#   67|       }

Error: CPPCHECK_WARNING (CWE-476): [#def46]
serd-0.32.6/src/writer.c:1095: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: writer
# 1093|     SerdWriter* writer = (SerdWriter*)calloc(1, sizeof(SerdWriter));
# 1094|   
# 1095|->   writer->syntax     = syntax;
# 1096|     writer->style      = style;
# 1097|     writer->env        = env;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def47]
serd-0.32.6/src/writer.c:1095:3: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘writer’
serd-0.32.6/src/writer.c:1093:37: acquire_memory: this call could return NULL
serd-0.32.6/src/writer.c:1095:3: danger: ‘writer’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/0)
# 1093|     SerdWriter* writer = (SerdWriter*)calloc(1, sizeof(SerdWriter));
# 1094|   
# 1095|->   writer->syntax     = syntax;
# 1096|     writer->style      = style;
# 1097|     writer->env        = env;

Error: CPPCHECK_WARNING (CWE-476): [#def48]
serd-0.32.6/src/writer.c:1096: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: writer
# 1094|   
# 1095|     writer->syntax     = syntax;
# 1096|->   writer->style      = style;
# 1097|     writer->env        = env;
# 1098|     writer->root_node  = SERD_NODE_NULL;

Error: CPPCHECK_WARNING (CWE-476): [#def49]
serd-0.32.6/src/writer.c:1097: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: writer
# 1095|     writer->syntax     = syntax;
# 1096|     writer->style      = style;
# 1097|->   writer->env        = env;
# 1098|     writer->root_node  = SERD_NODE_NULL;
# 1099|     writer->root_uri   = SERD_URI_NULL;

Error: CPPCHECK_WARNING (CWE-476): [#def50]
serd-0.32.6/src/writer.c:1098: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: writer
# 1096|     writer->style      = style;
# 1097|     writer->env        = env;
# 1098|->   writer->root_node  = SERD_NODE_NULL;
# 1099|     writer->root_uri   = SERD_URI_NULL;
# 1100|     writer->base_uri   = base_uri ? *base_uri : SERD_URI_NULL;

Error: CPPCHECK_WARNING (CWE-476): [#def51]
serd-0.32.6/src/writer.c:1099: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: writer
# 1097|     writer->env        = env;
# 1098|     writer->root_node  = SERD_NODE_NULL;
# 1099|->   writer->root_uri   = SERD_URI_NULL;
# 1100|     writer->base_uri   = base_uri ? *base_uri : SERD_URI_NULL;
# 1101|     writer->anon_stack = serd_stack_new(SERD_PAGE_SIZE);

Error: CPPCHECK_WARNING (CWE-476): [#def52]
serd-0.32.6/src/writer.c:1100: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: writer
# 1098|     writer->root_node  = SERD_NODE_NULL;
# 1099|     writer->root_uri   = SERD_URI_NULL;
# 1100|->   writer->base_uri   = base_uri ? *base_uri : SERD_URI_NULL;
# 1101|     writer->anon_stack = serd_stack_new(SERD_PAGE_SIZE);
# 1102|     writer->byte_sink  = serd_byte_sink_new(

Error: CPPCHECK_WARNING (CWE-476): [#def53]
serd-0.32.6/src/writer.c:1101: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: writer
# 1099|     writer->root_uri   = SERD_URI_NULL;
# 1100|     writer->base_uri   = base_uri ? *base_uri : SERD_URI_NULL;
# 1101|->   writer->anon_stack = serd_stack_new(SERD_PAGE_SIZE);
# 1102|     writer->byte_sink  = serd_byte_sink_new(
# 1103|       ssink, stream, (style & SERD_STYLE_BULK) ? SERD_PAGE_SIZE : 1);

Error: CPPCHECK_WARNING (CWE-476): [#def54]
serd-0.32.6/src/writer.c:1102: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: writer
# 1100|     writer->base_uri   = base_uri ? *base_uri : SERD_URI_NULL;
# 1101|     writer->anon_stack = serd_stack_new(SERD_PAGE_SIZE);
# 1102|->   writer->byte_sink  = serd_byte_sink_new(
# 1103|       ssink, stream, (style & SERD_STYLE_BULK) ? SERD_PAGE_SIZE : 1);
# 1104|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def55]
serd-0.32.6/src/writer.c:1133:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘*writer.bprefix’ where non-null expected
serd-0.32.6/src/writer.c:1129:29: branch_true: following ‘true’ branch (when ‘prefix’ is non-NULL)...
serd-0.32.6/src/writer.c:1129:38: branch_true: ...to here
serd-0.32.6/src/writer.c:1130:6: branch_true: following ‘true’ branch (when ‘prefix_len != 0’)...
serd-0.32.6/src/writer.c:1131:5: branch_true: ...to here
serd-0.32.6/src/writer.c:1132:37: acquire_memory: this call could return NULL
serd-0.32.6/src/writer.c:1133:5: danger: argument 1 (‘malloc(prefix_len + 1)’) from [(5)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/4) could be NULL where non-null expected
# 1131|       writer->bprefix_len = prefix_len;
# 1132|       writer->bprefix     = (uint8_t*)malloc(writer->bprefix_len + 1);
# 1133|->     memcpy(writer->bprefix, prefix, writer->bprefix_len + 1);
# 1134|     }
# 1135|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def56]
serd-0.32.6/test/test_node.c:133:37: warning[-Wanalyzer-malloc-leak]: leak of ‘data’
serd-0.32.6/test/test_node.c:126:25: branch_true: following ‘true’ branch (when ‘size != 256’)...
serd-0.32.6/test/test_node.c:127:37: branch_true: ...to here
serd-0.32.6/test/test_node.c:127:37: acquire_memory: allocated here
serd-0.32.6/test/test_node.c:128:5: branch_false: following ‘false’ branch (when ‘data’ is non-NULL)...
serd-0.32.6/test/test_node.c:128:5: branch_false: ...to here
serd-0.32.6/test/test_node.c:129:24: branch_true: following ‘true’ branch (when ‘size > i’)...
serd-0.32.6/test/test_node.c:130:27: branch_true: ...to here
serd-0.32.6/test/test_node.c:129:24: branch_false: following ‘false’ branch (when ‘size <= i’)...
serd-0.32.6/test/test_node.c:133:68: branch_false: ...to here
serd-0.32.6/test/test_node.c:133:37: throw: if ‘serd_node_new_blob’ throws an exception...
serd-0.32.6/test/test_node.c:133:37: danger: ‘data’ leaks here; was allocated at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#  131|       }
#  132|   
#  133|->     SerdNode             blob     = serd_node_new_blob(data, size, size % 5);
#  134|       const uint8_t* const blob_str = blob.buf;
#  135|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def57]
serd-0.32.6/test/test_node.c:142:17: warning[-Wanalyzer-malloc-leak]: leak of ‘data’
serd-0.32.6/test/test_node.c:126:25: branch_true: following ‘true’ branch (when ‘size != 256’)...
serd-0.32.6/test/test_node.c:127:37: branch_true: ...to here
serd-0.32.6/test/test_node.c:127:37: acquire_memory: allocated here
serd-0.32.6/test/test_node.c:128:5: branch_false: following ‘false’ branch (when ‘data’ is non-NULL)...
serd-0.32.6/test/test_node.c:128:5: branch_false: ...to here
serd-0.32.6/test/test_node.c:129:24: branch_true: following ‘true’ branch (when ‘size > i’)...
serd-0.32.6/test/test_node.c:130:27: branch_true: ...to here
serd-0.32.6/test/test_node.c:129:24: branch_false: following ‘false’ branch (when ‘size <= i’)...
serd-0.32.6/test/test_node.c:133:68: branch_false: ...to here
serd-0.32.6/test/test_node.c:136:5: branch_false: following ‘false’ branch (when ‘blob_str’ is non-NULL)...
serd-0.32.6/test/test_node.c:137:5: branch_false: ...to here
serd-0.32.6/test/test_node.c:137:5: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_node.c:138:5: branch_false: ...to here
serd-0.32.6/test/test_node.c:138:5: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_node.c:140:14: branch_false: ...to here
serd-0.32.6/test/test_node.c:142:17: throw: if ‘serd_base64_decode’ throws an exception...
serd-0.32.6/test/test_node.c:142:17: danger: ‘data’ leaks here; was allocated at [(3)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/2)
#  140|       size_t   out_size = 0;
#  141|       uint8_t* out =
#  142|->       (uint8_t*)serd_base64_decode(blob_str, blob.n_bytes, &out_size);
#  143|       assert(out_size == size);
#  144|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def58]
serd-0.32.6/test/test_node.c:149:5: warning[-Wanalyzer-malloc-leak]: leak of ‘data’
serd-0.32.6/test/test_node.c:126:25: branch_true: following ‘true’ branch (when ‘size != 256’)...
serd-0.32.6/test/test_node.c:127:37: branch_true: ...to here
serd-0.32.6/test/test_node.c:127:37: acquire_memory: allocated here
serd-0.32.6/test/test_node.c:128:5: branch_false: following ‘false’ branch (when ‘data’ is non-NULL)...
serd-0.32.6/test/test_node.c:128:5: branch_false: ...to here
serd-0.32.6/test/test_node.c:129:24: branch_true: following ‘true’ branch (when ‘size > i’)...
serd-0.32.6/test/test_node.c:130:27: branch_true: ...to here
serd-0.32.6/test/test_node.c:136:5: branch_false: following ‘false’ branch (when ‘blob_str’ is non-NULL)...
serd-0.32.6/test/test_node.c:137:5: branch_false: ...to here
serd-0.32.6/test/test_node.c:137:5: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_node.c:138:5: branch_false: ...to here
serd-0.32.6/test/test_node.c:138:5: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_node.c:140:14: branch_false: ...to here
serd-0.32.6/test/test_node.c:143:5: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_node.c:143:5: branch_false: ...to here
serd-0.32.6/test/test_node.c:145:24: branch_true: following ‘true’ branch (when ‘size > i’)...
serd-0.32.6/test/test_node.c:146:7: branch_true: ...to here
serd-0.32.6/test/test_node.c:146:7: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_node.c:145:34: branch_false: ...to here
serd-0.32.6/test/test_node.c:149:5: throw: if ‘serd_node_free’ throws an exception...
serd-0.32.6/test/test_node.c:149:5: danger: ‘data’ leaks here; was allocated at [(3)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/2)
#  147|       }
#  148|   
#  149|->     serd_node_free(&blob);
#  150|       serd_free(out);
#  151|       free(data);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def59]
serd-0.32.6/test/test_node.c:150:5: warning[-Wanalyzer-malloc-leak]: leak of ‘data’
serd-0.32.6/test/test_node.c:126:25: branch_true: following ‘true’ branch (when ‘size != 256’)...
serd-0.32.6/test/test_node.c:127:37: branch_true: ...to here
serd-0.32.6/test/test_node.c:127:37: acquire_memory: allocated here
serd-0.32.6/test/test_node.c:128:5: branch_false: following ‘false’ branch (when ‘data’ is non-NULL)...
serd-0.32.6/test/test_node.c:128:5: branch_false: ...to here
serd-0.32.6/test/test_node.c:129:24: branch_true: following ‘true’ branch (when ‘size > i’)...
serd-0.32.6/test/test_node.c:130:27: branch_true: ...to here
serd-0.32.6/test/test_node.c:136:5: branch_false: following ‘false’ branch (when ‘blob_str’ is non-NULL)...
serd-0.32.6/test/test_node.c:137:5: branch_false: ...to here
serd-0.32.6/test/test_node.c:137:5: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_node.c:138:5: branch_false: ...to here
serd-0.32.6/test/test_node.c:138:5: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_node.c:140:14: branch_false: ...to here
serd-0.32.6/test/test_node.c:143:5: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_node.c:143:5: branch_false: ...to here
serd-0.32.6/test/test_node.c:145:24: branch_true: following ‘true’ branch (when ‘size > i’)...
serd-0.32.6/test/test_node.c:146:7: branch_true: ...to here
serd-0.32.6/test/test_node.c:146:7: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_node.c:145:34: branch_false: ...to here
serd-0.32.6/test/test_node.c:150:5: throw: if ‘serd_free’ throws an exception...
serd-0.32.6/test/test_node.c:150:5: danger: ‘data’ leaks here; was allocated at [(3)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/2)
#  148|   
#  149|       serd_node_free(&blob);
#  150|->     serd_free(out);
#  151|       free(data);
#  152|     }

Error: GCC_ANALYZER_WARNING (CWE-775): [#def60]
serd-0.32.6/test/test_reader.c:180:3: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(path, "w+b")’
serd-0.32.6/test/test_reader.c:176:19: acquire_resource: opened here
serd-0.32.6/test/test_reader.c:177:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader.c:179:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:180:3: throw: if ‘fflush’ throws an exception...
serd-0.32.6/test/test_reader.c:180:3: danger: ‘fopen(path, "w+b")’ leaks here; was opened at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  178|   
#  179|     fprintf(f, "_:s <http://example.org/p> _:o .\n");
#  180|->   fflush(f);
#  181|     fseek(f, 0L, SEEK_SET);
#  182|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def61]
serd-0.32.6/test/test_reader.c:180:3: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(path, "w+b")’
serd-0.32.6/test/test_reader.c:176:19: acquire_memory: allocated here
serd-0.32.6/test/test_reader.c:177:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader.c:179:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:180:3: throw: if ‘fflush’ throws an exception...
serd-0.32.6/test/test_reader.c:180:3: danger: ‘fopen(path, "w+b")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#  178|   
#  179|     fprintf(f, "_:s <http://example.org/p> _:o .\n");
#  180|->   fflush(f);
#  181|     fseek(f, 0L, SEEK_SET);
#  182|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def62]
serd-0.32.6/test/test_reader.c:181:3: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(path, "w+b")’
serd-0.32.6/test/test_reader.c:176:19: acquire_resource: opened here
serd-0.32.6/test/test_reader.c:177:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader.c:179:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:181:3: throw: if ‘fseek’ throws an exception...
serd-0.32.6/test/test_reader.c:181:3: danger: ‘fopen(path, "w+b")’ leaks here; was opened at [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#  179|     fprintf(f, "_:s <http://example.org/p> _:o .\n");
#  180|     fflush(f);
#  181|->   fseek(f, 0L, SEEK_SET);
#  182|   
#  183|     ReaderTest        rt     = {0, 0, 0, 0};

Error: GCC_ANALYZER_WARNING (CWE-401): [#def63]
serd-0.32.6/test/test_reader.c:181:3: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(path, "w+b")’
serd-0.32.6/test/test_reader.c:176:19: acquire_memory: allocated here
serd-0.32.6/test/test_reader.c:177:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader.c:179:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:181:3: throw: if ‘fseek’ throws an exception...
serd-0.32.6/test/test_reader.c:181:3: danger: ‘fopen(path, "w+b")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/0)
#  179|     fprintf(f, "_:s <http://example.org/p> _:o .\n");
#  180|     fflush(f);
#  181|->   fseek(f, 0L, SEEK_SET);
#  182|   
#  183|     ReaderTest        rt     = {0, 0, 0, 0};

Error: GCC_ANALYZER_WARNING (CWE-775): [#def64]
serd-0.32.6/test/test_reader.c:184:30: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(path, "w+b")’
serd-0.32.6/test/test_reader.c:176:19: acquire_resource: opened here
serd-0.32.6/test/test_reader.c:177:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader.c:179:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:184:30: throw: if ‘serd_reader_new’ throws an exception...
serd-0.32.6/test/test_reader.c:184:30: danger: ‘fopen(path, "w+b")’ leaks here; was opened at [(1)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/0)
#  182|   
#  183|     ReaderTest        rt     = {0, 0, 0, 0};
#  184|->   SerdReader* const reader = serd_reader_new(
#  185|       SERD_TURTLE, &rt, NULL, base_sink, prefix_sink, statement_sink, end_sink);
#  186|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def65]
serd-0.32.6/test/test_reader.c:184:30: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(path, "w+b")’
serd-0.32.6/test/test_reader.c:176:19: acquire_memory: allocated here
serd-0.32.6/test/test_reader.c:177:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader.c:179:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:184:30: throw: if ‘serd_reader_new’ throws an exception...
serd-0.32.6/test/test_reader.c:184:30: danger: ‘fopen(path, "w+b")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/0)
#  182|   
#  183|     ReaderTest        rt     = {0, 0, 0, 0};
#  184|->   SerdReader* const reader = serd_reader_new(
#  185|       SERD_TURTLE, &rt, NULL, base_sink, prefix_sink, statement_sink, end_sink);
#  186|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def66]
serd-0.32.6/test/test_reader.c:187:3: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(path, "w+b")’
serd-0.32.6/test/test_reader.c:176:19: acquire_resource: opened here
serd-0.32.6/test/test_reader.c:177:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader.c:179:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:187:3: throw: if ‘fseek’ throws an exception...
serd-0.32.6/test/test_reader.c:187:3: danger: ‘fopen(path, "w+b")’ leaks here; was opened at [(1)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/0)
#  185|       SERD_TURTLE, &rt, NULL, base_sink, prefix_sink, statement_sink, end_sink);
#  186|   
#  187|->   fseek(f, 0L, SEEK_SET);
#  188|     serd_reader_start_stream(reader, f, (const uint8_t*)"test", true);
#  189|     assert(serd_reader_read_chunk(reader) == SERD_SUCCESS);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def67]
serd-0.32.6/test/test_reader.c:187:3: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(path, "w+b")’
serd-0.32.6/test/test_reader.c:176:19: acquire_memory: allocated here
serd-0.32.6/test/test_reader.c:177:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader.c:179:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:187:3: throw: if ‘fseek’ throws an exception...
serd-0.32.6/test/test_reader.c:187:3: danger: ‘fopen(path, "w+b")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/0)
#  185|       SERD_TURTLE, &rt, NULL, base_sink, prefix_sink, statement_sink, end_sink);
#  186|   
#  187|->   fseek(f, 0L, SEEK_SET);
#  188|     serd_reader_start_stream(reader, f, (const uint8_t*)"test", true);
#  189|     assert(serd_reader_read_chunk(reader) == SERD_SUCCESS);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def68]
serd-0.32.6/test/test_reader.c:188:3: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(path, "w+b")’
serd-0.32.6/test/test_reader.c:176:19: acquire_resource: opened here
serd-0.32.6/test/test_reader.c:177:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader.c:179:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:188:3: throw: if ‘serd_reader_start_stream’ throws an exception...
serd-0.32.6/test/test_reader.c:188:3: danger: ‘fopen(path, "w+b")’ leaks here; was opened at [(1)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/0)
#  186|   
#  187|     fseek(f, 0L, SEEK_SET);
#  188|->   serd_reader_start_stream(reader, f, (const uint8_t*)"test", true);
#  189|     assert(serd_reader_read_chunk(reader) == SERD_SUCCESS);
#  190|     assert(serd_reader_read_chunk(reader) == SERD_FAILURE);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def69]
serd-0.32.6/test/test_reader.c:188:3: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(path, "w+b")’
serd-0.32.6/test/test_reader.c:176:19: acquire_memory: allocated here
serd-0.32.6/test/test_reader.c:177:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader.c:179:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:188:3: throw: if ‘serd_reader_start_stream’ throws an exception...
serd-0.32.6/test/test_reader.c:188:3: danger: ‘fopen(path, "w+b")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/9/codeFlows/0/threadFlows/0/locations/0)
#  186|   
#  187|     fseek(f, 0L, SEEK_SET);
#  188|->   serd_reader_start_stream(reader, f, (const uint8_t*)"test", true);
#  189|     assert(serd_reader_read_chunk(reader) == SERD_SUCCESS);
#  190|     assert(serd_reader_read_chunk(reader) == SERD_FAILURE);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def70]
serd-0.32.6/test/test_reader.c:254:3: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(path, "w+b")’
serd-0.32.6/test/test_reader.c:235:19: acquire_resource: opened here
serd-0.32.6/test/test_reader.c:236:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader.c:240:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:254:3: throw: if ‘fseek’ throws an exception...
serd-0.32.6/test/test_reader.c:254:3: danger: ‘fopen(path, "w+b")’ leaks here; was opened at [(1)](sarif:/runs/0/results/10/codeFlows/0/threadFlows/0/locations/0)
#  252|             "<http://example.org/o3> .");
#  253|   
#  254|->   fseek(f, 0, SEEK_SET);
#  255|   
#  256|     ReaderTest        rt     = {0, 0, 0, 0};

Error: GCC_ANALYZER_WARNING (CWE-401): [#def71]
serd-0.32.6/test/test_reader.c:254:3: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(path, "w+b")’
serd-0.32.6/test/test_reader.c:235:19: acquire_memory: allocated here
serd-0.32.6/test/test_reader.c:236:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader.c:240:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:254:3: throw: if ‘fseek’ throws an exception...
serd-0.32.6/test/test_reader.c:254:3: danger: ‘fopen(path, "w+b")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/11/codeFlows/0/threadFlows/0/locations/0)
#  252|             "<http://example.org/o3> .");
#  253|   
#  254|->   fseek(f, 0, SEEK_SET);
#  255|   
#  256|     ReaderTest        rt     = {0, 0, 0, 0};

Error: GCC_ANALYZER_WARNING (CWE-401): [#def72]
serd-0.32.6/test/test_reader.c:254:3: warning[-Wanalyzer-malloc-leak]: leak of ‘path’
serd-0.32.6/test/test_reader.c:410:1: enter_function: entry to ‘main’
serd-0.32.6/test/test_reader.c:426:43: acquire_memory: allocated here
serd-0.32.6/test/test_reader.c:427:3: branch_false: following ‘false’ branch (when ‘path’ is non-NULL)...
serd-0.32.6/test/test_reader.c:429:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:433:3: call_function: calling ‘test_read_nquads_chunks’ from ‘main’
#  252|             "<http://example.org/o3> .");
#  253|   
#  254|->   fseek(f, 0, SEEK_SET);
#  255|   
#  256|     ReaderTest        rt     = {0, 0, 0, 0};

Error: GCC_ANALYZER_WARNING (CWE-775): [#def73]
serd-0.32.6/test/test_reader.c:257:30: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(path, "w+b")’
serd-0.32.6/test/test_reader.c:235:19: acquire_resource: opened here
serd-0.32.6/test/test_reader.c:236:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader.c:240:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:257:30: throw: if ‘serd_reader_new’ throws an exception...
serd-0.32.6/test/test_reader.c:257:30: danger: ‘fopen(path, "w+b")’ leaks here; was opened at [(1)](sarif:/runs/0/results/13/codeFlows/0/threadFlows/0/locations/0)
#  255|   
#  256|     ReaderTest        rt     = {0, 0, 0, 0};
#  257|->   SerdReader* const reader = serd_reader_new(
#  258|       SERD_NQUADS, &rt, NULL, base_sink, prefix_sink, statement_sink, end_sink);
#  259|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def74]
serd-0.32.6/test/test_reader.c:257:30: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(path, "w+b")’
serd-0.32.6/test/test_reader.c:235:19: acquire_memory: allocated here
serd-0.32.6/test/test_reader.c:236:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader.c:240:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:257:30: throw: if ‘serd_reader_new’ throws an exception...
serd-0.32.6/test/test_reader.c:257:30: danger: ‘fopen(path, "w+b")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/14/codeFlows/0/threadFlows/0/locations/0)
#  255|   
#  256|     ReaderTest        rt     = {0, 0, 0, 0};
#  257|->   SerdReader* const reader = serd_reader_new(
#  258|       SERD_NQUADS, &rt, NULL, base_sink, prefix_sink, statement_sink, end_sink);
#  259|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def75]
serd-0.32.6/test/test_reader.c:257:30: warning[-Wanalyzer-malloc-leak]: leak of ‘path’
serd-0.32.6/test/test_reader.c:410:1: enter_function: entry to ‘main’
serd-0.32.6/test/test_reader.c:426:43: acquire_memory: allocated here
serd-0.32.6/test/test_reader.c:427:3: branch_false: following ‘false’ branch (when ‘path’ is non-NULL)...
serd-0.32.6/test/test_reader.c:429:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:433:3: call_function: calling ‘test_read_nquads_chunks’ from ‘main’
#  255|   
#  256|     ReaderTest        rt     = {0, 0, 0, 0};
#  257|->   SerdReader* const reader = serd_reader_new(
#  258|       SERD_NQUADS, &rt, NULL, base_sink, prefix_sink, statement_sink, end_sink);
#  259|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def76]
serd-0.32.6/test/test_reader.c:264:19: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(path, "w+b")’
serd-0.32.6/test/test_reader.c:235:19: acquire_resource: opened here
serd-0.32.6/test/test_reader.c:236:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader.c:240:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:260:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader.c:261:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:261:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader.c:264:19: branch_false: ...to here
serd-0.32.6/test/test_reader.c:264:19: throw: if ‘serd_reader_start_source_stream’ throws an exception...
serd-0.32.6/test/test_reader.c:264:19: danger: ‘fopen(path, "w+b")’ leaks here; was opened at [(1)](sarif:/runs/0/results/16/codeFlows/0/threadFlows/0/locations/0)
#  262|     assert(f);
#  263|   
#  264|->   SerdStatus st = serd_reader_start_source_stream(
#  265|       reader, (SerdSource)fread, (SerdStreamErrorFunc)ferror, f, NULL, 32U);
#  266|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def77]
serd-0.32.6/test/test_reader.c:264:19: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(path, "w+b")’
serd-0.32.6/test/test_reader.c:235:19: acquire_memory: allocated here
serd-0.32.6/test/test_reader.c:236:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader.c:240:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:260:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader.c:261:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:261:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader.c:264:19: branch_false: ...to here
serd-0.32.6/test/test_reader.c:264:19: throw: if ‘serd_reader_start_source_stream’ throws an exception...
serd-0.32.6/test/test_reader.c:264:19: danger: ‘fopen(path, "w+b")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/17/codeFlows/0/threadFlows/0/locations/0)
#  262|     assert(f);
#  263|   
#  264|->   SerdStatus st = serd_reader_start_source_stream(
#  265|       reader, (SerdSource)fread, (SerdStreamErrorFunc)ferror, f, NULL, 32U);
#  266|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def78]
serd-0.32.6/test/test_reader.c:264:19: warning[-Wanalyzer-malloc-leak]: leak of ‘path’
serd-0.32.6/test/test_reader.c:410:1: enter_function: entry to ‘main’
serd-0.32.6/test/test_reader.c:426:43: acquire_memory: allocated here
serd-0.32.6/test/test_reader.c:427:3: branch_false: following ‘false’ branch (when ‘path’ is non-NULL)...
serd-0.32.6/test/test_reader.c:429:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:433:3: call_function: calling ‘test_read_nquads_chunks’ from ‘main’
#  262|     assert(f);
#  263|   
#  264|->   SerdStatus st = serd_reader_start_source_stream(
#  265|       reader, (SerdSource)fread, (SerdStreamErrorFunc)ferror, f, NULL, 32U);
#  266|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def79]
serd-0.32.6/test/test_reader.c:270:8: warning[-Wanalyzer-malloc-leak]: leak of ‘path’
serd-0.32.6/test/test_reader.c:410:1: enter_function: entry to ‘main’
serd-0.32.6/test/test_reader.c:426:43: acquire_memory: allocated here
serd-0.32.6/test/test_reader.c:427:3: branch_false: following ‘false’ branch (when ‘path’ is non-NULL)...
serd-0.32.6/test/test_reader.c:429:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:433:3: call_function: calling ‘test_read_nquads_chunks’ from ‘main’
#  268|   
#  269|     // Read first statement
#  270|->   st = serd_reader_read_chunk(reader);
#  271|     assert(st == SERD_SUCCESS);
#  272|     assert(rt.n_base == 0);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def80]
serd-0.32.6/test/test_reader.c:278:8: warning[-Wanalyzer-malloc-leak]: leak of ‘path’
serd-0.32.6/test/test_reader.c:410:1: enter_function: entry to ‘main’
serd-0.32.6/test/test_reader.c:426:43: acquire_memory: allocated here
serd-0.32.6/test/test_reader.c:427:3: branch_false: following ‘false’ branch (when ‘path’ is non-NULL)...
serd-0.32.6/test/test_reader.c:429:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:433:3: call_function: calling ‘test_read_nquads_chunks’ from ‘main’
#  276|   
#  277|     // Read second statement
#  278|->   st = serd_reader_read_chunk(reader);
#  279|     assert(st == SERD_SUCCESS);
#  280|     assert(rt.n_base == 0);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def81]
serd-0.32.6/test/test_reader.c:286:8: warning[-Wanalyzer-malloc-leak]: leak of ‘path’
serd-0.32.6/test/test_reader.c:410:1: enter_function: entry to ‘main’
serd-0.32.6/test/test_reader.c:426:43: acquire_memory: allocated here
serd-0.32.6/test/test_reader.c:427:3: branch_false: following ‘false’ branch (when ‘path’ is non-NULL)...
serd-0.32.6/test/test_reader.c:429:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:433:3: call_function: calling ‘test_read_nquads_chunks’ from ‘main’
#  284|   
#  285|     // Read terminator
#  286|->   st = serd_reader_read_chunk(reader);
#  287|     assert(st == SERD_FAILURE);
#  288|     assert(rt.n_base == 0);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def82]
serd-0.32.6/test/test_reader.c:294:8: warning[-Wanalyzer-malloc-leak]: leak of ‘path’
serd-0.32.6/test/test_reader.c:410:1: enter_function: entry to ‘main’
serd-0.32.6/test/test_reader.c:426:43: acquire_memory: allocated here
serd-0.32.6/test/test_reader.c:427:3: branch_false: following ‘false’ branch (when ‘path’ is non-NULL)...
serd-0.32.6/test/test_reader.c:429:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:433:3: call_function: calling ‘test_read_nquads_chunks’ from ‘main’
#  292|   
#  293|     // Read last statement
#  294|->   st = serd_reader_read_chunk(reader);
#  295|     assert(st == SERD_SUCCESS);
#  296|     assert(rt.n_base == 0);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def83]
serd-0.32.6/test/test_reader.c:302:8: warning[-Wanalyzer-malloc-leak]: leak of ‘path’
serd-0.32.6/test/test_reader.c:410:1: enter_function: entry to ‘main’
serd-0.32.6/test/test_reader.c:426:43: acquire_memory: allocated here
serd-0.32.6/test/test_reader.c:427:3: branch_false: following ‘false’ branch (when ‘path’ is non-NULL)...
serd-0.32.6/test/test_reader.c:429:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:433:3: call_function: calling ‘test_read_nquads_chunks’ from ‘main’
#  300|   
#  301|     // EOF
#  302|->   st = serd_reader_read_chunk(reader);
#  303|     assert(st == SERD_FAILURE);
#  304|     assert(rt.n_base == 0);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def84]
serd-0.32.6/test/test_reader.c:332:3: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(path, "w+b")’
serd-0.32.6/test/test_reader.c:322:19: acquire_resource: opened here
serd-0.32.6/test/test_reader.c:323:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader.c:326:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:332:3: throw: if ‘fseek’ throws an exception...
serd-0.32.6/test/test_reader.c:332:3: danger: ‘fopen(path, "w+b")’ leaks here; was opened at [(1)](sarif:/runs/0/results/24/codeFlows/0/threadFlows/0/locations/0)
#  330|     fwrite(&null, sizeof(null), 1, f);
#  331|     fprintf(f, "eg:s eg:p [ eg:sp eg:so ] .");
#  332|->   fseek(f, 0, SEEK_SET);
#  333|   
#  334|     ReaderTest        rt     = {0, 0, 0, 0};

Error: GCC_ANALYZER_WARNING (CWE-401): [#def85]
serd-0.32.6/test/test_reader.c:332:3: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(path, "w+b")’
serd-0.32.6/test/test_reader.c:322:19: acquire_memory: allocated here
serd-0.32.6/test/test_reader.c:323:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader.c:326:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:332:3: throw: if ‘fseek’ throws an exception...
serd-0.32.6/test/test_reader.c:332:3: danger: ‘fopen(path, "w+b")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/25/codeFlows/0/threadFlows/0/locations/0)
#  330|     fwrite(&null, sizeof(null), 1, f);
#  331|     fprintf(f, "eg:s eg:p [ eg:sp eg:so ] .");
#  332|->   fseek(f, 0, SEEK_SET);
#  333|   
#  334|     ReaderTest        rt     = {0, 0, 0, 0};

Error: GCC_ANALYZER_WARNING (CWE-775): [#def86]
serd-0.32.6/test/test_reader.c:335:30: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(path, "w+b")’
serd-0.32.6/test/test_reader.c:322:19: acquire_resource: opened here
serd-0.32.6/test/test_reader.c:323:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader.c:326:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:335:30: throw: if ‘serd_reader_new’ throws an exception...
serd-0.32.6/test/test_reader.c:335:30: danger: ‘fopen(path, "w+b")’ leaks here; was opened at [(1)](sarif:/runs/0/results/26/codeFlows/0/threadFlows/0/locations/0)
#  333|   
#  334|     ReaderTest        rt     = {0, 0, 0, 0};
#  335|->   SerdReader* const reader = serd_reader_new(
#  336|       SERD_TURTLE, &rt, NULL, base_sink, prefix_sink, statement_sink, end_sink);
#  337|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def87]
serd-0.32.6/test/test_reader.c:335:30: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(path, "w+b")’
serd-0.32.6/test/test_reader.c:322:19: acquire_memory: allocated here
serd-0.32.6/test/test_reader.c:323:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader.c:326:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:335:30: throw: if ‘serd_reader_new’ throws an exception...
serd-0.32.6/test/test_reader.c:335:30: danger: ‘fopen(path, "w+b")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/27/codeFlows/0/threadFlows/0/locations/0)
#  333|   
#  334|     ReaderTest        rt     = {0, 0, 0, 0};
#  335|->   SerdReader* const reader = serd_reader_new(
#  336|       SERD_TURTLE, &rt, NULL, base_sink, prefix_sink, statement_sink, end_sink);
#  337|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def88]
serd-0.32.6/test/test_reader.c:342:19: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(path, "w+b")’
serd-0.32.6/test/test_reader.c:322:19: acquire_resource: opened here
serd-0.32.6/test/test_reader.c:323:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader.c:326:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:338:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader.c:339:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:339:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader.c:342:19: branch_false: ...to here
serd-0.32.6/test/test_reader.c:342:19: throw: if ‘serd_reader_start_source_stream’ throws an exception...
serd-0.32.6/test/test_reader.c:342:19: danger: ‘fopen(path, "w+b")’ leaks here; was opened at [(1)](sarif:/runs/0/results/28/codeFlows/0/threadFlows/0/locations/0)
#  340|     assert(f);
#  341|   
#  342|->   SerdStatus st = serd_reader_start_source_stream(
#  343|       reader, (SerdSource)fread, (SerdStreamErrorFunc)ferror, f, NULL, 32U);
#  344|     assert(st == SERD_SUCCESS);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def89]
serd-0.32.6/test/test_reader.c:342:19: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(path, "w+b")’
serd-0.32.6/test/test_reader.c:322:19: acquire_memory: allocated here
serd-0.32.6/test/test_reader.c:323:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader.c:326:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:338:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader.c:339:3: branch_false: ...to here
serd-0.32.6/test/test_reader.c:339:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader.c:342:19: branch_false: ...to here
serd-0.32.6/test/test_reader.c:342:19: throw: if ‘serd_reader_start_source_stream’ throws an exception...
serd-0.32.6/test/test_reader.c:342:19: danger: ‘fopen(path, "w+b")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/29/codeFlows/0/threadFlows/0/locations/0)
#  340|     assert(f);
#  341|   
#  342|->   SerdStatus st = serd_reader_start_source_stream(
#  343|       reader, (SerdSource)fread, (SerdStreamErrorFunc)ferror, f, NULL, 32U);
#  344|     assert(st == SERD_SUCCESS);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def90]
serd-0.32.6/test/test_reader_writer.c:114:27: warning[-Wanalyzer-malloc-leak]: leak of ‘path’
serd-0.32.6/test/test_reader_writer.c:294:1: enter_function: entry to ‘main’
serd-0.32.6/test/test_reader_writer.c:308:43: acquire_memory: allocated here
serd-0.32.6/test/test_reader_writer.c:309:3: branch_false: following ‘false’ branch (when ‘path’ is non-NULL)...
serd-0.32.6/test/test_reader_writer.c:311:3: branch_false: ...to here
serd-0.32.6/test/test_reader_writer.c:315:3: call_function: calling ‘test_write_errors’ from ‘main’
#  112|     ErrorContext    ctx   = {0U, offset};
#  113|     const SerdStyle style = (SerdStyle)(SERD_STYLE_STRICT | SERD_STYLE_CURIED);
#  114|->   SerdEnv* const  env   = serd_env_new(NULL);
#  115|     assert(env);
#  116|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def91]
serd-0.32.6/test/test_reader_writer.c:118:5: warning[-Wanalyzer-malloc-leak]: leak of ‘path’
serd-0.32.6/test/test_reader_writer.c:294:1: enter_function: entry to ‘main’
serd-0.32.6/test/test_reader_writer.c:308:43: acquire_memory: allocated here
serd-0.32.6/test/test_reader_writer.c:309:3: branch_false: following ‘false’ branch (when ‘path’ is non-NULL)...
serd-0.32.6/test/test_reader_writer.c:311:3: branch_false: ...to here
serd-0.32.6/test/test_reader_writer.c:315:3: call_function: calling ‘test_write_errors’ from ‘main’
#  116|   
#  117|     SerdWriter* const writer =
#  118|->     serd_writer_new(syntax, style, env, NULL, faulty_sink, &ctx);
#  119|     assert(writer);
#  120|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def92]
serd-0.32.6/test/test_reader_writer.c:122:5: warning[-Wanalyzer-malloc-leak]: leak of ‘path’
serd-0.32.6/test/test_reader_writer.c:294:1: enter_function: entry to ‘main’
serd-0.32.6/test/test_reader_writer.c:308:43: acquire_memory: allocated here
serd-0.32.6/test/test_reader_writer.c:309:3: branch_false: following ‘false’ branch (when ‘path’ is non-NULL)...
serd-0.32.6/test/test_reader_writer.c:311:3: branch_false: ...to here
serd-0.32.6/test/test_reader_writer.c:315:3: call_function: calling ‘test_write_errors’ from ‘main’
#  120|   
#  121|     SerdReader* const reader =
#  122|->     serd_reader_new(SERD_TRIG,
#  123|                       writer,
#  124|                       NULL,

Error: GCC_ANALYZER_WARNING (CWE-401): [#def93]
serd-0.32.6/test/test_reader_writer.c:131:3: warning[-Wanalyzer-malloc-leak]: leak of ‘path’
serd-0.32.6/test/test_reader_writer.c:294:1: enter_function: entry to ‘main’
serd-0.32.6/test/test_reader_writer.c:308:43: acquire_memory: allocated here
serd-0.32.6/test/test_reader_writer.c:309:3: branch_false: following ‘false’ branch (when ‘path’ is non-NULL)...
serd-0.32.6/test/test_reader_writer.c:311:3: branch_false: ...to here
serd-0.32.6/test/test_reader_writer.c:315:3: call_function: calling ‘test_write_errors’ from ‘main’
#  129|     assert(reader);
#  130|   
#  131|->   serd_writer_set_error_sink(writer, quiet_error_sink, NULL);
#  132|     serd_reader_set_error_sink(reader, quiet_error_sink, NULL);
#  133|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def94]
serd-0.32.6/test/test_reader_writer.c:132:3: warning[-Wanalyzer-malloc-leak]: leak of ‘path’
serd-0.32.6/test/test_reader_writer.c:294:1: enter_function: entry to ‘main’
serd-0.32.6/test/test_reader_writer.c:308:43: acquire_memory: allocated here
serd-0.32.6/test/test_reader_writer.c:309:3: branch_false: following ‘false’ branch (when ‘path’ is non-NULL)...
serd-0.32.6/test/test_reader_writer.c:311:3: branch_false: ...to here
serd-0.32.6/test/test_reader_writer.c:315:3: call_function: calling ‘test_write_errors’ from ‘main’
#  130|   
#  131|     serd_writer_set_error_sink(writer, quiet_error_sink, NULL);
#  132|->   serd_reader_set_error_sink(reader, quiet_error_sink, NULL);
#  133|   
#  134|     const SerdStatus rst = serd_reader_read_string(reader, USTR(doc_string));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def95]
serd-0.32.6/test/test_reader_writer.c:134:26: warning[-Wanalyzer-malloc-leak]: leak of ‘path’
serd-0.32.6/test/test_reader_writer.c:294:1: enter_function: entry to ‘main’
serd-0.32.6/test/test_reader_writer.c:308:43: acquire_memory: allocated here
serd-0.32.6/test/test_reader_writer.c:309:3: branch_false: following ‘false’ branch (when ‘path’ is non-NULL)...
serd-0.32.6/test/test_reader_writer.c:311:3: branch_false: ...to here
serd-0.32.6/test/test_reader_writer.c:315:3: call_function: calling ‘test_write_errors’ from ‘main’
#  132|     serd_reader_set_error_sink(reader, quiet_error_sink, NULL);
#  133|   
#  134|->   const SerdStatus rst = serd_reader_read_string(reader, USTR(doc_string));
#  135|     const SerdStatus wst = serd_writer_finish(writer);
#  136|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def96]
serd-0.32.6/test/test_reader_writer.c:135:26: warning[-Wanalyzer-malloc-leak]: leak of ‘path’
serd-0.32.6/test/test_reader_writer.c:294:1: enter_function: entry to ‘main’
serd-0.32.6/test/test_reader_writer.c:308:43: acquire_memory: allocated here
serd-0.32.6/test/test_reader_writer.c:309:3: branch_false: following ‘false’ branch (when ‘path’ is non-NULL)...
serd-0.32.6/test/test_reader_writer.c:311:3: branch_false: ...to here
serd-0.32.6/test/test_reader_writer.c:315:3: call_function: calling ‘test_write_errors’ from ‘main’
#  133|   
#  134|     const SerdStatus rst = serd_reader_read_string(reader, USTR(doc_string));
#  135|->   const SerdStatus wst = serd_writer_finish(writer);
#  136|   
#  137|     serd_reader_free(reader);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def97]
serd-0.32.6/test/test_reader_writer.c:137:3: warning[-Wanalyzer-malloc-leak]: leak of ‘path’
serd-0.32.6/test/test_reader_writer.c:294:1: enter_function: entry to ‘main’
serd-0.32.6/test/test_reader_writer.c:308:43: acquire_memory: allocated here
serd-0.32.6/test/test_reader_writer.c:309:3: branch_false: following ‘false’ branch (when ‘path’ is non-NULL)...
serd-0.32.6/test/test_reader_writer.c:311:3: branch_false: ...to here
serd-0.32.6/test/test_reader_writer.c:315:3: call_function: calling ‘test_write_errors’ from ‘main’
#  135|     const SerdStatus wst = serd_writer_finish(writer);
#  136|   
#  137|->   serd_reader_free(reader);
#  138|     serd_writer_free(writer);
#  139|     serd_env_free(env);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def98]
serd-0.32.6/test/test_reader_writer.c:170:24: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(path, "wb")’
serd-0.32.6/test/test_reader_writer.c:167:20: acquire_resource: opened here
serd-0.32.6/test/test_reader_writer.c:168:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader_writer.c:170:24: branch_false: ...to here
serd-0.32.6/test/test_reader_writer.c:170:24: throw: if ‘serd_env_new’ throws an exception...
serd-0.32.6/test/test_reader_writer.c:170:24: danger: ‘fopen(path, "wb")’ leaks here; was opened at [(1)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/0)
#  168|     assert(fd);
#  169|   
#  170|->   SerdEnv* const env = serd_env_new(NULL);
#  171|     assert(env);
#  172|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def99]
serd-0.32.6/test/test_reader_writer.c:170:24: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(path, "wb")’
serd-0.32.6/test/test_reader_writer.c:167:20: acquire_memory: allocated here
serd-0.32.6/test/test_reader_writer.c:168:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader_writer.c:170:24: branch_false: ...to here
serd-0.32.6/test/test_reader_writer.c:170:24: throw: if ‘serd_env_new’ throws an exception...
serd-0.32.6/test/test_reader_writer.c:170:24: danger: ‘fopen(path, "wb")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/9/codeFlows/0/threadFlows/0/locations/0)
#  168|     assert(fd);
#  169|   
#  170|->   SerdEnv* const env = serd_env_new(NULL);
#  171|     assert(env);
#  172|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def100]
serd-0.32.6/test/test_reader_writer.c:174:5: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(path, "wb")’
serd-0.32.6/test/test_reader_writer.c:167:20: acquire_resource: opened here
serd-0.32.6/test/test_reader_writer.c:168:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader_writer.c:170:24: branch_false: ...to here
serd-0.32.6/test/test_reader_writer.c:171:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader_writer.c:174:5: branch_false: ...to here
serd-0.32.6/test/test_reader_writer.c:174:5: throw: if ‘serd_writer_new’ throws an exception...
serd-0.32.6/test/test_reader_writer.c:174:5: danger: ‘fopen(path, "wb")’ leaks here; was opened at [(1)](sarif:/runs/0/results/10/codeFlows/0/threadFlows/0/locations/0)
#  172|   
#  173|     SerdWriter* writer =
#  174|->     serd_writer_new(SERD_TURTLE, (SerdStyle)0, env, NULL, serd_file_sink, fd);
#  175|     assert(writer);
#  176|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def101]
serd-0.32.6/test/test_reader_writer.c:174:5: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(path, "wb")’
serd-0.32.6/test/test_reader_writer.c:167:20: acquire_memory: allocated here
serd-0.32.6/test/test_reader_writer.c:168:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader_writer.c:170:24: branch_false: ...to here
serd-0.32.6/test/test_reader_writer.c:171:3: branch_false: following ‘false’ branch...
serd-0.32.6/test/test_reader_writer.c:174:5: branch_false: ...to here
serd-0.32.6/test/test_reader_writer.c:174:5: throw: if ‘serd_writer_new’ throws an exception...
serd-0.32.6/test/test_reader_writer.c:174:5: danger: ‘fopen(path, "wb")’ leaks here; was allocated at [(1)](sarif:/runs/0/results/11/codeFlows/0/threadFlows/0/locations/0)
#  172|   
#  173|     SerdWriter* writer =
#  174|->     serd_writer_new(SERD_TURTLE, (SerdStyle)0, env, NULL, serd_file_sink, fd);
#  175|     assert(writer);
#  176|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def102]
serd-0.32.6/test/test_reader_writer.c:257:24: warning[-Wanalyzer-malloc-leak]: leak of ‘rt’
serd-0.32.6/test/test_reader_writer.c:254:39: acquire_memory: allocated here
serd-0.32.6/test/test_reader_writer.c:255:3: branch_false: following ‘false’ branch (when ‘rt’ is non-NULL)...
serd-0.32.6/test/test_reader_writer.c:257:24: branch_false: ...to here
serd-0.32.6/test/test_reader_writer.c:257:24: throw: if ‘serd_reader_new’ throws an exception...
serd-0.32.6/test/test_reader_writer.c:257:24: danger: ‘rt’ leaks here; was allocated at [(1)](sarif:/runs/0/results/12/codeFlows/0/threadFlows/0/locations/0)
#  255|     assert(rt);
#  256|   
#  257|->   SerdReader* reader = serd_reader_new(
#  258|       SERD_TURTLE, rt, free, NULL, NULL, test_statement_sink, NULL);
#  259|   

Scan Properties

analyzer-version-clippy1.92.0
analyzer-version-cppcheck2.19.1
analyzer-version-gcc16.0.0
analyzer-version-gcc-analyzer16.0.0
analyzer-version-shellcheck0.11.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-181.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20250521.132812.g8eff701.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-nameserd-0.32.6-1.fc44
store-results-to/tmp/tmpybpoyxi_/serd-0.32.6-1.fc44.tar.xz
time-created2026-01-08 21:45:17
time-finished2026-01-08 21:46:47
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,cppcheck,clippy,shellcheck,unicontrol' '-o' '/tmp/tmpybpoyxi_/serd-0.32.6-1.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpybpoyxi_/serd-0.32.6-1.fc44.src.rpm'
tool-versioncsmock-3.8.3.20251215.161544.g62de9a5-1.el9