nbdkit-1.41.8-1.fc42

List of Findings

Error: SHELLCHECK_WARNING (CWE-457): [#def1]
/usr/share/doc/nbdkit-devel/assemble.sh:18:11: warning[SC2154]: tmpdir is referenced but not assigned.
#   16|   
#   17|   # Check we're being run from nbdkit.
#   18|-> if [ ! -d $tmpdir ] || [ "x$1" = "x" ]; then
#   19|       echo "$0: this script must be run from nbdkit" >&2
#   20|       echo "Use ‘nbdkit sh $0’" >&2

Error: SHELLCHECK_WARNING (CWE-457): [#def2]
/usr/share/doc/nbdkit-devel/example.sh:45:11: warning[SC2154]: tmpdir is referenced but not assigned.
#   43|   #
#   44|   # - $1 is set (to a method name).
#   45|-> if [ ! -d $tmpdir ] || [ "x$1" = "x" ]; then
#   46|       echo "$0: this script must be run from nbdkit" >&2
#   47|       echo "Use ‘nbdkit sh $0’" >&2

Error: CPPCHECK_WARNING (CWE-401): [#def3]
nbdkit-1.41.8-build/nbdkit-1.41.8/common/allocators/zstd.c:328: error[memleakOnRealloc]: Common realloc mistake: 'page' nulled but not freed upon failure
#  326|         return -1;
#  327|       }
#  328|->     page = realloc (page, n);
#  329|       assert (page != NULL);
#  330|       l2_dir[o].page = page;

Error: GCC_ANALYZER_WARNING (CWE-457): [#def4]
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/tvdiff.h:48:24: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'start_t.tv_sec'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/vddk/vddk.c: scope_hint: In function 'vddk_open'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/vddk/vddk.c:849:3: note: in expansion of macro 'VDDK_CALL_START'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.h:101: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/vddk/vddk.c:56: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/cleanup.h:60:3: note: in expansion of macro 'ACQUIRE_LOCK_FOR_CURRENT_SCOPE_1'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/vddk/vddk.c:704:3: note: in expansion of macro 'ACQUIRE_LOCK_FOR_CURRENT_SCOPE'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/vddk/vddk.c:849:3: note: in expansion of macro 'VDDK_CALL_START'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/vddk/vddk.c:849:3: note: in expansion of macro 'VDDK_CALL_START'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/vddk/vddk.c:851:3: note: in expansion of macro 'VDDK_CALL_END'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/vddk/vddk.c:851:3: note: in expansion of macro 'VDDK_CALL_END'
#   46|     int64_t usec;
#   47|   
#   48|->   usec = (y->tv_sec - x->tv_sec) * 1000000;
#   49|     usec += y->tv_usec - x->tv_usec;
#   50|     return usec;

Error: CPPCHECK_WARNING (CWE-476): [#def5]
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/const-string-vector.h:40: error[ctunullpointer]: Null pointer dereference: key
#   38|   #include "vector.h"
#   39|   
#   40|-> DEFINE_VECTOR_TYPE (const_string_vector, const char *);
#   41|   
#   42|   /* This frees only the array. */

Error: CPPCHECK_WARNING (CWE-476): [#def6]
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/nbdkit-string.h:40: error[ctunullpointer]: Null pointer dereference: key
#   38|   #include "vector.h"
#   39|   
#   40|-> DEFINE_VECTOR_TYPE (string, char);
#   41|   #define CLEANUP_FREE_STRING __attribute__ ((cleanup (string_reset)))
#   42|   

Error: CPPCHECK_WARNING (CWE-476): [#def7]
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/string-vector.h:40: error[ctunullpointer]: Null pointer dereference: key
#   38|   #include "vector.h"
#   39|   
#   40|-> DEFINE_POINTER_VECTOR_TYPE (string_vector, char *);
#   41|   
#   42|   /* This frees both the array and the strings. */

Error: CPPCHECK_WARNING (CWE-457): [#def8]
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.c:72: error[uninitvar]: Uninitialized variable: newbytes
#   70|         ADD_OVERFLOW (v->cap, t/2, &newcap) ||
#   71|         MUL_OVERFLOW (newcap, itemsize, &newbytes) ||
#   72|->       newbytes < reqbytes) {
#   73|       /* If that either overflows or is less than the minimum requested,
#   74|        * fall back to the requested capacity.

Error: CPPCHECK_WARNING (CWE-457): [#def9]
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.c:72: error[uninitvar]: Uninitialized variable: reqbytes
#   70|         ADD_OVERFLOW (v->cap, t/2, &newcap) ||
#   71|         MUL_OVERFLOW (newcap, itemsize, &newbytes) ||
#   72|->       newbytes < reqbytes) {
#   73|       /* If that either overflows or is less than the minimum requested,
#   74|        * fall back to the requested capacity.

Error: CPPCHECK_WARNING (CWE-457): [#def10]
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.c:76: error[uninitvar]: Uninitialized variable: reqcap
#   74|        * fall back to the requested capacity.
#   75|        */
#   76|->     newcap = reqcap;
#   77|       newbytes = reqbytes;
#   78|     }

Error: CPPCHECK_WARNING (CWE-457): [#def11]
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.c:80: warning[uninitvar]: Uninitialized variable: newcap
#   78|     }
#   79|   
#   80|->   *newcap_r = newcap;
#   81|     *newbytes_r = newbytes;
#   82|     return 0;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def12]
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.h:127:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open(&cmdline_file, 524288)'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/nbdkit-string.h:40:1: note: in expansion of macro 'DEFINE_VECTOR_TYPE'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/vddk/reexec.c: scope_hint: In function 'perform_reexec'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/nbdkit-string.h:40:1: note: in expansion of macro 'DEFINE_VECTOR_TYPE'
#  125|     name##_reserve (name *v, size_t n)                                    \
#  126|     {                                                                     \
#  127|->     return generic_vector_reserve ((struct generic_vector *)v, n,       \
#  128|                                      sizeof (type), false);               \
#  129|     }                                                                     \

Error: GCC_ANALYZER_WARNING (CWE-476): [#def13]
nbdkit-1.41.8-build/nbdkit-1.41.8/contrib/sparseloadtest.c: scope_hint: In function ‘start_thread’
nbdkit-1.41.8-build/nbdkit-1.41.8/contrib/sparseloadtest.c:364:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘data’
#  362|   
#  363|       data = malloc (sizeof *data); /* freed in callback */
#  364|->     data->count = count;
#  365|   
#  366|       if (pc_read_actual < pc_read) { /* read op */

Error: CPPCHECK_WARNING (CWE-401): [#def14]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/bzip2/bzip2.c:204: error[memleak]: Memory leak: in_block
#  202|     if (!out_block) {
#  203|       nbdkit_error ("malloc: %m");
#  204|->     return -1;
#  205|     }
#  206|   

Error: CPPCHECK_WARNING (CWE-401): [#def15]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/checkwrite/checkwrite.c:137: error[memleak]: Memory leak: expected
#  135|     /* Read underlying plugin data into the buffer. */
#  136|     if (next->pread (next, expected, count, offset, 0, err) == -1)
#  137|->     return -1;
#  138|   
#  139|     /* If data written doesn't match data expected, inject EIO. */

Error: CPPCHECK_WARNING (CWE-401): [#def16]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/checkwrite/checkwrite.c:141: error[memleak]: Memory leak: expected
#  139|     /* If data written doesn't match data expected, inject EIO. */
#  140|     if (memcmp (buf, expected, count) != 0)
#  141|->     return data_does_not_match (err);
#  142|   
#  143|     return 0;

Error: CPPCHECK_WARNING (CWE-401): [#def17]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/checkwrite/checkwrite.c:143: error[memleak]: Memory leak: expected
#  141|       return data_does_not_match (err);
#  142|   
#  143|->   return 0;
#  144|   }
#  145|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def18]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/cow/cow.c: scope_hint: In function 'cow_trim'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/cow/cow.c:536:9: warning[-Wanalyzer-null-argument]: use of NULL 'block' where non-null expected
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/rounding.h:36: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/cow/cow.c:54: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/cow/cow.c:516:8: note: in expansion of macro 'IS_ALIGNED'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/cow/cow.c: scope_hint: In function 'cow_trim'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/isaligned.h:44:10: note: in definition of macro 'IS_ALIGNED'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/cow/cow.c:53: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/minmax.h:59:19: note: in definition of macro 'MIN_1'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/unique-name.h:40:37: note: in expansion of macro 'XXUNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/unique-name.h:41:34: note: in expansion of macro 'XUNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/minmax.h:51:20: note: in expansion of macro 'NBDKIT_UNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/cow/cow.c:530:18: note: in expansion of macro 'MIN'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/cleanup.h:60:3: note: in expansion of macro 'ACQUIRE_LOCK_FOR_CURRENT_SCOPE_1'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/cow/cow.c:535:5: note: in expansion of macro 'ACQUIRE_LOCK_FOR_CURRENT_SCOPE'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/cow/cow.c:57: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/cow/blk.h:49:12: note: argument 3 of 'blk_read' must be non-null
#  534|        */
#  535|       ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&rmw_lock);
#  536|->     r = blk_read (next, blknum, block, cow_on_read (), err);
#  537|       if (r != -1) {
#  538|         memset (&block[blkoffs], 0, n);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def19]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/cow/cow.c:563:9: warning[-Wanalyzer-null-argument]: use of NULL 'block' where non-null expected
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/cow/cow.c:516:8: note: in expansion of macro 'IS_ALIGNED'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/cow/cow.c: scope_hint: In function 'cow_trim'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/isaligned.h:44:10: note: in definition of macro 'IS_ALIGNED'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/cow/cow.c:50: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/cleanup.h:62:41: note: in definition of macro 'ACQUIRE_LOCK_FOR_CURRENT_SCOPE_1'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/unique-name.h:40:37: note: in expansion of macro 'XXUNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/unique-name.h:41:34: note: in expansion of macro 'XUNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/cleanup.h:60:46: note: in expansion of macro 'NBDKIT_UNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/cow/cow.c:562:5: note: in expansion of macro 'ACQUIRE_LOCK_FOR_CURRENT_SCOPE'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/cleanup.h:60:3: note: in expansion of macro 'ACQUIRE_LOCK_FOR_CURRENT_SCOPE_1'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/cow/cow.c:562:5: note: in expansion of macro 'ACQUIRE_LOCK_FOR_CURRENT_SCOPE'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/cow/blk.h:49:12: note: argument 3 of 'blk_read' must be non-null
#  561|     if (count) {
#  562|       ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&rmw_lock);
#  563|->     r = blk_read (next, blknum, block, cow_on_read (), err);
#  564|       if (r != -1) {
#  565|         memset (block, 0, count);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def20]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/ddrescue/ddrescue.c: scope_hint: In function 'parse_mapfile'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/ddrescue/ddrescue.c:74:8: warning[-Wanalyzer-file-leak]: leak of FILE 'fopen(filename, "r")'
#   72|     int status_seen = 0;
#   73|   
#   74|->   fp = fopen (filename, "r");
#   75|     if (!fp) {
#   76|       nbdkit_error ("%s: ddrescue: fopen: %m", filename);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def21]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/ddrescue/ddrescue.c:74:8: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(filename, "r")'
#   72|     int status_seen = 0;
#   73|   
#   74|->   fp = fopen (filename, "r");
#   75|     if (!fp) {
#   76|       nbdkit_error ("%s: ddrescue: fopen: %m", filename);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def22]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/exitwhen/exitwhen.c:373:14: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'event.u.fd'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.h:170:12: note: in definition of macro 'DEFINE_VECTOR_TYPE'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/exitwhen/exitwhen.c: scope_hint: In function 'exitwhen_config'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.h:154:3: note: in definition of macro 'DEFINE_VECTOR_TYPE'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/exitwhen/exitwhen.c:84:1: note: in expansion of macro 'DEFINE_VECTOR_TYPE'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.h:170:12: note: in definition of macro 'DEFINE_VECTOR_TYPE'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/exitwhen/exitwhen.c: scope_hint: In function 'exitwhen_config'
#  371|       event.u.filename = nbdkit_absolute_path (value);
#  372|       if (event.u.filename == NULL)
#  373|->       return -1;
#  374|   #ifdef EVENT_FD_CLOSED
#  375|     append_event:

Error: GCC_ANALYZER_WARNING (CWE-401): [#def23]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/exitwhen/exitwhen.c: scope_hint: In function 'exitwhen_config'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/exitwhen/exitwhen.c:373:14: warning[-Wanalyzer-malloc-leak]: leak of 'event.u.filename'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.h:170:12: note: in definition of macro 'DEFINE_VECTOR_TYPE'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/exitwhen/exitwhen.c: scope_hint: In function 'exitwhen_config'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.h:154:3: note: in definition of macro 'DEFINE_VECTOR_TYPE'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.h:101: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/exitwhen/exitwhen.c:84:1: note: in expansion of macro 'DEFINE_VECTOR_TYPE'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.h:170:12: note: in definition of macro 'DEFINE_VECTOR_TYPE'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/exitwhen/exitwhen.c: scope_hint: In function 'exitwhen_config'
#  371|       event.u.filename = nbdkit_absolute_path (value);
#  372|       if (event.u.filename == NULL)
#  373|->       return -1;
#  374|   #ifdef EVENT_FD_CLOSED
#  375|     append_event:

Error: GCC_ANALYZER_WARNING (CWE-775): [#def24]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/exitwhen/exitwhen.c:408:18: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open(str, 0)'
#  406|         return -1;
#  407|       }
#  408|->     event.u.fd = open (str, O_RDONLY);
#  409|       if (event.u.fd == -1) {
#  410|         nbdkit_error ("exit-when-process-exits: %s: %m", str);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def25]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/exportname/exportname.c: scope_hint: In function 'get_desc'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/exportname/exportname.c:191:8: warning[-Wanalyzer-malloc-leak]: leak of 'popen(cmd, "r")'
#  189|     }
#  190|     nbdkit_debug ("%s", cmd);
#  191|->   fp = popen (cmd, "r");
#  192|     if (fp == NULL) {
#  193|       nbdkit_debug ("popen: %m");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def26]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/exportname/exportname.c:198:7: warning[-Wanalyzer-malloc-leak]: leak of 'popen(cmd, "r")'
#  196|   
#  197|     /* Now read the description */
#  198|->   r = fread (buf, 1, sizeof buf, fp);
#  199|     if (r == 0 && ferror (fp)) {
#  200|       nbdkit_debug ("fread: %m");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def27]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/exportname/exportname.c:200:5: warning[-Wanalyzer-malloc-leak]: leak of 'popen(cmd, "r")'
#  198|     r = fread (buf, 1, sizeof buf, fp);
#  199|     if (r == 0 && ferror (fp)) {
#  200|->     nbdkit_debug ("fread: %m");
#  201|       pclose (fp);
#  202|       return NULL;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def28]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/extentlist/extentlist.c: scope_hint: In function 'parse_extentlist'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/extentlist/extentlist.c:139:8: warning[-Wanalyzer-file-leak]: leak of FILE 'fopen(extentlist, "r")'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.h:101: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/extentlist/extentlist.c:48: included_from: Included from here.
#  137|     assert (extents.len == 0);
#  138|   
#  139|->   fp = fopen (extentlist, "r");
#  140|     if (!fp) {
#  141|       nbdkit_error ("open: %s: %m", extentlist);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def29]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/extentlist/extentlist.c:139:8: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(extentlist, "r")'
#  137|     assert (extents.len == 0);
#  138|   
#  139|->   fp = fopen (extentlist, "r");
#  140|     if (!fp) {
#  141|       nbdkit_error ("open: %s: %m", extentlist);

Error: CPPCHECK_WARNING (CWE-401): [#def30]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/gzip/gzip.c:203: error[memleak]: Memory leak: in_block
#  201|     if (!out_block) {
#  202|       nbdkit_error ("malloc: %m");
#  203|->     return -1;
#  204|     }
#  205|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def31]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/luks/luks-encryption.c:489:26: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'block'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/luks/luks-encryption.c: scope_hint: In function 'afmerge'
#  487|   
#  488|     for (i = 0; i < len; ++i)
#  489|->     out[i] = in1[i] ^ in2[i];
#  490|   }
#  491|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def32]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/luks/luks-encryption.c: scope_hint: In function 'af_hash'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/luks/luks-encryption.c:529:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'block' where non-null expected
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/luks/luks-encryption.c: scope_hint: In function 'af_hash'
/usr/include/sys/types.h:176: included_from: Included from here.
/usr/include/stdlib.h:514: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/luks/luks-encryption.c:36: included_from: Included from here.
<built-in>: note: argument 1 of '__builtin_memcpy' must be non-null
#  527|       gnutls_hash_deinit (hash, temp);
#  528|   
#  529|->     memcpy (&block[i*digest_bytes], temp, blen);
#  530|     }
#  531|   

Error: CPPCHECK_WARNING (CWE-401): [#def33]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/luks/luks-encryption.c:610: error[memleak]: Memory leak: split_key
#  608|     if (masterkey == NULL) {
#  609|       nbdkit_error ("malloc: %m");
#  610|->     return -1;
#  611|     }
#  612|   

Error: CPPCHECK_WARNING (CWE-401): [#def34]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/luks/luks-encryption.c:618: error[memleak]: Memory leak: split_key
#  616|     if (r != 0) {
#  617|       nbdkit_error ("gnutls_pbkdf2: %s", gnutls_strerror (r));
#  618|->     return -1;
#  619|     }
#  620|   

Error: CPPCHECK_WARNING (CWE-401): [#def35]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/luks/luks-encryption.c:625: error[memleak]: Memory leak: split_key
#  623|     if (next->pread (next, split_key, split_key_len, start, 0, &err) == -1) {
#  624|       errno = err;
#  625|->     return -1;
#  626|     }
#  627|   

Error: CPPCHECK_WARNING (CWE-401): [#def36]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/luks/luks-encryption.c:634: error[memleak]: Memory leak: split_key
#  632|     if (r != 0) {
#  633|       nbdkit_error ("gnutls_cipher_init: %s", gnutls_strerror (r));
#  634|->     return -1;
#  635|     }
#  636|   

Error: CPPCHECK_WARNING (CWE-401): [#def37]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/luks/luks.c:355: error[memleak]: Memory leak: sector
#  353|     cipher = create_cipher (h->h);
#  354|     if (!cipher)
#  355|->     return -1;
#  356|   
#  357|     /* Unaligned head */

Error: GCC_ANALYZER_WARNING (CWE-688): [#def38]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/qcow2dec/qcow2dec.c: scope_hint: In function 'read_cluster'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/qcow2dec/qcow2dec.c:509:5: warning[-Wanalyzer-null-argument]: use of NULL 'buf' where non-null expected
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/rounding.h:36: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/qcow2dec/qcow2dec.c:77: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/qcow2dec/qcow2dec.c:448:8: note: in expansion of macro 'IS_ALIGNED'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/qcow2dec/qcow2dec.c: scope_hint: In function 'read_cluster'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/isaligned.h:44:10: note: in definition of macro 'IS_ALIGNED'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/qcow2dec/qcow2dec.c:76: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/minmax.h:59:19: note: in definition of macro 'MIN_1'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/unique-name.h:40:37: note: in expansion of macro 'XXUNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/unique-name.h:41:34: note: in expansion of macro 'XUNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/minmax.h:51:20: note: in expansion of macro 'NBDKIT_UNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/qcow2dec/qcow2dec.c:461:18: note: in expansion of macro 'MIN'
<built-in>: note: argument 1 of '__builtin_memset' must be non-null
#  507|     /* L2 table is unallocated, so return zeroes. */
#  508|     if (!l2_present) {
#  509|->     memset (buf, 0, cluster_size);
#  510|       return 0;
#  511|     }

Error: GCC_ANALYZER_WARNING (CWE-688): [#def39]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/qcow2dec/qcow2dec.c:533:5: warning[-Wanalyzer-null-argument]: use of NULL 'buf' where non-null expected
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/qcow2dec/qcow2dec.c:448:8: note: in expansion of macro 'IS_ALIGNED'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/qcow2dec/qcow2dec.c: scope_hint: In function 'read_cluster'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/isaligned.h:44:10: note: in definition of macro 'IS_ALIGNED'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/minmax.h:59:19: note: in definition of macro 'MIN_1'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/unique-name.h:40:37: note: in expansion of macro 'XXUNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/unique-name.h:41:34: note: in expansion of macro 'XUNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/minmax.h:51:20: note: in expansion of macro 'NBDKIT_UNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/qcow2dec/qcow2dec.c:461:18: note: in expansion of macro 'MIN'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/cleanup.h:60:3: note: in expansion of macro 'ACQUIRE_LOCK_FOR_CURRENT_SCOPE_1'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/qcow2dec/qcow2dec.c:587:5: note: in expansion of macro 'ACQUIRE_LOCK_FOR_CURRENT_SCOPE'
<built-in>: note: argument 1 of '__builtin_memset' must be non-null
#  531|      */
#  532|     if ((l2_entry & 1) != 0 || file_offset == 0) {
#  533|->     memset (buf, 0, cluster_size);
#  534|       return 0;
#  535|     }

Error: CPPCHECK_WARNING (CWE-401): [#def40]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/qcow2dec/qcow2dec.c:848: error[memleak]: Memory leak: compressed_cluster
#  846|     if (next->pread (next, compressed_cluster, compressed_size, file_offset,
#  847|                      flags, err) == -1)
#  848|->     return -1;
#  849|   
#  850|     /* This is the time to find out if we support this type of

Error: GCC_ANALYZER_WARNING (CWE-775): [#def41]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/rate/rate.c: scope_hint: In function 'maybe_adjust'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/rate/rate.c:224:8: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open(file, 524288)'
#  222|      * fork() in a parallel thread model.
#  223|      */
#  224|->   fd = open (file, O_CLOEXEC | O_RDONLY);
#  225|     if (fd == -1)
#  226|       return; /* this is not an error */

Error: CPPCHECK_WARNING (CWE-476): [#def42]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/readahead/readahead.h:49: error[ctunullpointer]: Null pointer dereference: key
#   47|     uint32_t count;
#   48|   };
#   49|-> DEFINE_VECTOR_TYPE (command_queue, struct command);
#   50|   
#   51|   struct bgthread_ctrl {

Error: CPPCHECK_WARNING (CWE-476): [#def43]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/scan/scan.h:52: error[ctunullpointer]: Null pointer dereference: key
#   50|     uint64_t offset;
#   51|   };
#   52|-> DEFINE_VECTOR_TYPE (command_queue, struct command);
#   53|   
#   54|   struct bgthread_ctrl {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def44]
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.h:101: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/spinning/spinning.c:47: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/spinning/spinning.c: scope_hint: In function 'do_seek'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/spinning/spinning.c:349:15: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
#  347|     /* Find which head is responsible for this part of the disk. */
#  348|     head = heads_vector_search (&h->heads, &new_pos, find_range);
#  349|->   assert (head->start <= new_pos && new_pos < head->end);
#  350|   
#  351|     /* Offset of new_pos relative to the start of this head's range. */

Error: GCC_ANALYZER_WARNING (CWE-131): [#def45]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/swab/swab.c: scope_hint: In function 'swab_pwrite'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/swab/swab.c:184:9: warning[-Wanalyzer-allocation-size]: allocated buffer size is not a multiple of the pointee's size
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/rounding.h:36: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/swab/swab.c:48: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/swab/swab.c:115:8: note: in expansion of macro 'IS_ALIGNED'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/swab/swab.c: scope_hint: In function 'swab_pwrite'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/swab/swab.c:115:8: note: in expansion of macro 'IS_ALIGNED'
#  182|     if (!is_aligned (count, offset, err)) return -1;
#  183|   
#  184|->   block = malloc (count);
#  185|     if (block == NULL) {
#  186|       *err = errno;

Error: CPPCHECK_WARNING (CWE-401): [#def46]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/tar/tar.c:207: error[memleak]: Memory leak: buf
#  205|     copysize = next->get_size (next);
#  206|     if (copysize == -1)
#  207|->     return -1;
#  208|     if (tar_limit > 0 && copysize > tar_limit)
#  209|       copysize = tar_limit;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def47]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/tar/tar.c: scope_hint: In function 'calculate_offset_of_entry'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/tar/tar.c:213:8: warning[-Wanalyzer-malloc-leak]: leak of 'popen(cmd, "w")'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/cleanup.h:41: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/tar/tar.c:50: included_from: Included from here.
#  211|     /* Run the tar command. */
#  212|     nbdkit_debug ("%s", cmd);
#  213|->   fp = popen (cmd, "w");
#  214|     if (fp == NULL) {
#  215|       nbdkit_error ("tar: %m");

Error: CPPCHECK_WARNING (CWE-401): [#def48]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/tar/tar.c:216: error[memleak]: Memory leak: buf
#  214|     if (fp == NULL) {
#  215|       nbdkit_error ("tar: %m");
#  216|->     return -1;
#  217|     }
#  218|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def49]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/tar/tar.c:225:31: warning[-Wanalyzer-malloc-leak]: leak of 'popen(cmd, "w")'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/tar/tar.c:52: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/minmax.h:60:19: note: in definition of macro 'MIN_1'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/unique-name.h:40:37: note: in expansion of macro 'XXUNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/unique-name.h:41:34: note: in expansion of macro 'XUNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/minmax.h:51:45: note: in expansion of macro 'NBDKIT_UNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/tar/tar.c:227:27: note: in expansion of macro 'MIN'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/minmax.h:60:19: note: in definition of macro 'MIN_1'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/unique-name.h:40:37: note: in expansion of macro 'XXUNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/unique-name.h:41:34: note: in expansion of macro 'XUNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/minmax.h:51:45: note: in expansion of macro 'NBDKIT_UNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/tar/tar.c:227:27: note: in expansion of macro 'MIN'
#  223|      * files.
#  224|      */
#  225|->   for (i = 0; i < copysize; i += bufsize) {
#  226|       int err, r;
#  227|       const int64_t count = MIN (bufsize, copysize-i);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def50]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/tar/tar.c:231:9: warning[-Wanalyzer-malloc-leak]: leak of 'popen(cmd, "w")'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/minmax.h:60:19: note: in definition of macro 'MIN_1'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/unique-name.h:40:37: note: in expansion of macro 'XXUNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/unique-name.h:41:34: note: in expansion of macro 'XUNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/minmax.h:51:45: note: in expansion of macro 'NBDKIT_UNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/tar/tar.c:227:27: note: in expansion of macro 'MIN'
#  229|       struct stat statbuf;
#  230|   
#  231|->     r = next->pread (next, buf, count, i, 0, &err);
#  232|       if (r == -1) {
#  233|         errno = err;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def51]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/tar/tar.c:234:7: warning[-Wanalyzer-malloc-leak]: leak of 'popen(cmd, "w")'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/minmax.h:60:19: note: in definition of macro 'MIN_1'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/unique-name.h:40:37: note: in expansion of macro 'XXUNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/unique-name.h:41:34: note: in expansion of macro 'XUNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/minmax.h:51:45: note: in expansion of macro 'NBDKIT_UNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/tar/tar.c:227:27: note: in expansion of macro 'MIN'
nbdkit-1.41.8-build/nbdkit-1.41.8/include/nbdkit-common.h:42: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/include/nbdkit-filter.h:40: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/tar/tar.c:48: included_from: Included from here.
#  232|       if (r == -1) {
#  233|         errno = err;
#  234|->       nbdkit_error ("pread: %m");
#  235|         pclose (fp);
#  236|         return -1;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def52]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/tar/tar.c:239:49: warning[-Wanalyzer-malloc-leak]: leak of 'popen(cmd, "w")'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/minmax.h:60:19: note: in definition of macro 'MIN_1'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/unique-name.h:40:37: note: in expansion of macro 'XXUNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/unique-name.h:41:34: note: in expansion of macro 'XUNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/minmax.h:51:45: note: in expansion of macro 'NBDKIT_UNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/tar/tar.c:227:27: note: in expansion of macro 'MIN'
#  237|       }
#  238|       for (j = 0; j < count;) {
#  239|->       size_t written = fwrite (&buf[j], 1, count-j, fp);
#  240|         if (written == 0) {
#  241|           nbdkit_error ("tar: error writing to subprocess");

Error: GCC_ANALYZER_WARNING (CWE-775): [#def53]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/tar/tar.c:255:8: warning[-Wanalyzer-file-leak]: leak of FILE 'fopen(&output, "r")'
#  253|   
#  254|     /* Open the tar output and try to parse it. */
#  255|->   fp = fopen (output, "r");
#  256|     if (fp == NULL) {
#  257|       nbdkit_error ("%s: %m", output);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def54]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/tar/tar.c:255:8: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(&output, "r")'
#  253|   
#  254|     /* Open the tar output and try to parse it. */
#  255|->   fp = fopen (output, "r");
#  256|     if (fp == NULL) {
#  257|       nbdkit_error ("%s: %m", output);

Error: CPPCHECK_WARNING (CWE-401): [#def55]
nbdkit-1.41.8-build/nbdkit-1.41.8/filters/time-limit/time-limit.c:101: error[memleak]: Memory leak: h
#   99|   
#  100|     if (next (nxdata, readonly, exportname) == -1)
#  101|->     return NULL;
#  102|   
#  103|     return h;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def56]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/cdi/cdi.c: scope_hint: In function 'make_layer'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/cdi/cdi.c:132:8: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open(template, 524288)'
#  130|     /* Since the script likely overwrites the file, we need to reopen it. */
#  131|     close (fd);
#  132|->   fd = open (template, O_RDONLY|O_CLOEXEC);
#  133|     if (fd == -1) {
#  134|       nbdkit_error ("open: %s: %m", template);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def57]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/curl/scripts.c: scope_hint: In function 'run_header_script'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/curl/scripts.c:212:8: warning[-Wanalyzer-malloc-leak]: leak of 'popen(cmd, "r")'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/cleanup.h:41: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/curl/scripts.c:51: included_from: Included from here.
#  210|     /* Run the script and read the headers. */
#  211|     nbdkit_debug ("curl: running header-script");
#  212|->   fp = popen (cmd, "r");
#  213|     if (fp == NULL) {
#  214|       nbdkit_error ("popen: %m");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def58]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/curl/scripts.c: scope_hint: In function 'run_cookie_script'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/curl/scripts.c:292:8: warning[-Wanalyzer-malloc-leak]: leak of 'popen(cmd, "r")'
#  290|     /* Run the script and read the cookies. */
#  291|     nbdkit_debug ("curl: running cookie-script");
#  292|->   fp = popen (cmd, "r");
#  293|     if (fp == NULL) {
#  294|       nbdkit_error ("popen: %m");

Error: GCC_ANALYZER_WARNING (CWE-775): [#def59]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/curl/scripts.c: scope_hint: In function 'error_from_tmpfile'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/curl/scripts.c:334:8: warning[-Wanalyzer-file-leak]: leak of FILE 'fopen(tmpfile, "r")'
#  332|     size_t linelen = 0;
#  333|   
#  334|->   fp = fopen (tmpfile, "r");
#  335|   
#  336|     if (fp && (n = getline (&line, &linelen, fp)) >= 0) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def60]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/curl/scripts.c:334:8: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(tmpfile, "r")'
#  332|     size_t linelen = 0;
#  333|   
#  334|->   fp = fopen (tmpfile, "r");
#  335|   
#  336|     if (fp && (n = getline (&line, &linelen, fp)) >= 0) {

Error: CPPCHECK_WARNING (CWE-758): [#def61]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/data/format.c:1615: warning[objectIndex]: The address of variable 'root' might be accessed at non-zero index.
# 1613|   
# 1614|     for (i = 0; i < list.len; ++i) {
# 1615|->     const expr_t e = get_node (list.ptr[i]);
# 1616|   
# 1617|       switch (e.t) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def62]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/data/format.c: scope_hint: In function 'evaluate'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/data/format.c:1623:16: warning[-Wanalyzer-malloc-leak]: leak of 'd'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/rounding.h:36: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/data/format.c:57: included_from: Included from here.
# 1621|         /* Store the byte. */
# 1622|         if (a->f->write (a, &e.b, 1, *offset) == -1)
# 1623|->         return -1;
# 1624|         (*offset)++;
# 1625|         break;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def63]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/data/format.c: scope_hint: In function 'store_file_slice'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/data/format.c:1882:7: warning[-Wanalyzer-file-leak]: leak of FILE 'fopen(filename, "r")'
# 1880|     }
# 1881|   
# 1882|->   if (fseek (fp, skip, SEEK_SET) == -1) {
# 1883|       nbdkit_error ("%s: fseek: %m", filename);
# 1884|       return -1;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def64]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/data/format.c:1882:7: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(filename, "r")'
# 1880|     }
# 1881|   
# 1882|->   if (fseek (fp, skip, SEEK_SET) == -1) {
# 1883|       nbdkit_error ("%s: fseek: %m", filename);
# 1884|       return -1;

Error: CPPCHECK_WARNING (CWE-404): [#def65]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/data/format.c:1884: error[resourceLeak]: Resource leak: fp
# 1882|     if (fseek (fp, skip, SEEK_SET) == -1) {
# 1883|       nbdkit_error ("%s: fseek: %m", filename);
# 1884|->     return -1;
# 1885|     }
# 1886|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def66]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/eval/call.c:370:10: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'in_fd[0]'
#  368|       waitpid (pid, NULL, 0);
#  369|   
#  370|->   return ret;
#  371|   }
#  372|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def67]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/eval/call.c: scope_hint: In function 'call3'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/eval/call.c:370:10: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'in_fd[ret]'
#  368|       waitpid (pid, NULL, 0);
#  369|   
#  370|->   return ret;
#  371|   }
#  372|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def68]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/eval/call.c:370:10: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'out_fd[0]'
#  368|       waitpid (pid, NULL, 0);
#  369|   
#  370|->   return ret;
#  371|   }
#  372|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def69]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/eval/call.c:370:10: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'out_fd[ret]'
#  368|       waitpid (pid, NULL, 0);
#  369|   
#  370|->   return ret;
#  371|   }
#  372|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def70]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/floppy/directory-lfn.c: scope_hint: In function 'convert_to_utf16le'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/floppy/directory-lfn.c:471:6: warning[-Wanalyzer-malloc-leak]: leak of 'iconv_open(&lfn_encoding, "UTF-8")'
#  469|     /* XXX Assumes current locale is UTF-8. */
#  470|     ic = iconv_open (lfn_encoding, "UTF-8");
#  471|->   if (ic == (iconv_t)-1) {
#  472|       nbdkit_error ("iconv: %m");
#  473|       return -1;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def71]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/floppy/virtual-floppy.c: scope_hint: In function 'visit'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/floppy/virtual-floppy.c:297:9: warning[-Wanalyzer-malloc-leak]: leak of 'opendir(".")'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.h:170:12: note: in definition of macro 'DEFINE_VECTOR_TYPE'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/floppy/virtual-floppy.h: scope_hint: In function 'visit'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.h:154:3: note: in definition of macro 'DEFINE_VECTOR_TYPE'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/rounding.h:36: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/floppy/virtual-floppy.c:54: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/floppy/virtual-floppy.h:173:1: note: in expansion of macro 'DEFINE_VECTOR_TYPE'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/floppy/virtual-floppy.h:173:1: note: in expansion of macro 'DEFINE_VECTOR_TYPE'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.h:170:12: note: in definition of macro 'DEFINE_VECTOR_TYPE'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/floppy/virtual-floppy.c: scope_hint: In function 'visit'
#  295|     }
#  296|   
#  297|->   DIR = opendir (".");
#  298|     if (DIR == NULL) {
#  299|       nbdkit_error ("opendir: %s: %m", dir);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def72]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/floppy/virtual-floppy.c: scope_hint: In function 'visit_subdirectory'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/floppy/virtual-floppy.c:386:6: warning[-Wanalyzer-malloc-leak]: leak of 'strdup(name)'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.h:170:12: note: in definition of macro 'DEFINE_VECTOR_TYPE'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/floppy/virtual-floppy.h: scope_hint: In function 'visit_subdirectory'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.h:154:3: note: in definition of macro 'DEFINE_VECTOR_TYPE'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/floppy/virtual-floppy.h:173:1: note: in expansion of macro 'DEFINE_VECTOR_TYPE'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/floppy/virtual-floppy.h:173:1: note: in expansion of macro 'DEFINE_VECTOR_TYPE'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.h:170:12: note: in definition of macro 'DEFINE_VECTOR_TYPE'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/floppy/virtual-floppy.c: scope_hint: In function 'visit_subdirectory'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/floppy/virtual-floppy.c:42: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/floppy/virtual-floppy.c:46: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.h:170:12: note: in definition of macro 'DEFINE_VECTOR_TYPE'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/floppy/virtual-floppy.h: scope_hint: In function 'visit_subdirectory'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.h:154:3: note: in definition of macro 'DEFINE_VECTOR_TYPE'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/floppy/virtual-floppy.h:173:1: note: in expansion of macro 'DEFINE_VECTOR_TYPE'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/floppy/virtual-floppy.h:173:1: note: in expansion of macro 'DEFINE_VECTOR_TYPE'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.h:170:12: note: in definition of macro 'DEFINE_VECTOR_TYPE'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/floppy/virtual-floppy.c: scope_hint: In function 'visit_subdirectory'
#  384|     /* We must set sdi->name because visit() cannot set it. */
#  385|     floppy->dirs.ptr[sdi].name = strdup (name);
#  386|->   if (floppy->dirs.ptr[sdi].name == NULL) {
#  387|       nbdkit_error ("strdup: %m");
#  388|       return -1;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def73]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/linuxdisk/filesystem.c: scope_hint: In function 'estimate_size'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/linuxdisk/filesystem.c:172:8: warning[-Wanalyzer-malloc-leak]: leak of 'popen(command, "r")'
#  170|     /* Run the command. */
#  171|     nbdkit_debug ("%s", command);
#  172|->   fp = popen (command, "r");
#  173|     if (fp == NULL) {
#  174|       nbdkit_error ("du command failed: %m");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def74]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/nbd/nbd.c: scope_hint: In function 'nbdplug_default_export'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/nbd/nbd.c:779:28: warning[-Wanalyzer-malloc-leak]: leak of 'nbd_create()'
#  777|      * might still work on "" later on).
#  778|      */
#  779|->   struct nbd_handle *nbd = nbd_create ();
#  780|   
#  781|     if (!nbd)

Error: GCC_ANALYZER_WARNING (CWE-401): [#def75]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/nbd/nbd.c:793:10: warning[-Wanalyzer-malloc-leak]: leak of 'nbd_get_canonical_export_name(nbd_create())'
#  791|     if (nbd_opt_info (nbd) == -1)
#  792|       goto out;
#  793|->   name = nbd_get_canonical_export_name (nbd);
#  794|     if (name)
#  795|       ret = nbdkit_strdup_intern (name);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def76]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/python/plugin.c: scope_hint: In function 'py_config'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/python/plugin.c:156:10: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open(value, 524288)'
#  154|        * easier to use open/fdopen than fopen/fcntl(fileno).
#  155|        */
#  156|->     fd = open (script, O_CLOEXEC | O_RDONLY);
#  157|       if (fd == -1) {
#  158|         nbdkit_error ("%s: cannot open file: %m", script);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def77]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/sh/call.c:370:10: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'in_fd[0]'
#  368|       waitpid (pid, NULL, 0);
#  369|   
#  370|->   return ret;
#  371|   }
#  372|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def78]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/sh/call.c: scope_hint: In function 'call3'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/sh/call.c:370:10: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'in_fd[ret]'
#  368|       waitpid (pid, NULL, 0);
#  369|   
#  370|->   return ret;
#  371|   }
#  372|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def79]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/sh/call.c:370:10: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'out_fd[0]'
#  368|       waitpid (pid, NULL, 0);
#  369|   
#  370|->   return ret;
#  371|   }
#  372|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def80]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/sh/call.c:370:10: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'out_fd[ret]'
#  368|       waitpid (pid, NULL, 0);
#  369|   
#  370|->   return ret;
#  371|   }
#  372|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def81]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/sparse-random/sparse-random.c: scope_hint: In function 'read_block'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/sparse-random/sparse-random.c:302:5: warning[-Wanalyzer-null-argument]: use of NULL 'buf' where non-null expected
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/sparse-random/sparse-random.c:50: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/minmax.h:59:19: note: in definition of macro 'MIN_1'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/unique-name.h:40:37: note: in expansion of macro 'XXUNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/unique-name.h:41:34: note: in expansion of macro 'XUNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/minmax.h:51:20: note: in expansion of macro 'NBDKIT_UNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/sparse-random/sparse-random.c:344:18: note: in expansion of macro 'MIN'
<built-in>: note: argument 1 of '__builtin_memset' must be non-null
#  300|   
#  301|     if (bitmap_get_blk (&bm, blknum, 0) == 0) /* hole */
#  302|->     memset (buf, 0, BLOCKSIZE);
#  303|     else if (!random_content) {   /* data when random-content=false */
#  304|       xsrandom (seed + offset, &state);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def82]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/sparse-random/sparse-random.c: scope_hint: In function 'read_block.part.0'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/sparse-random/sparse-random.c:308:5: warning[-Wanalyzer-null-argument]: use of NULL 'buf' where non-null expected
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/minmax.h:59:19: note: in definition of macro 'MIN_1'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/unique-name.h:40:37: note: in expansion of macro 'XXUNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/unique-name.h:41:34: note: in expansion of macro 'XUNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/minmax.h:51:20: note: in expansion of macro 'NBDKIT_UNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/sparse-random/sparse-random.c:344:18: note: in expansion of macro 'MIN'
<built-in>: note: argument 1 of '__builtin_memset' must be non-null
#  306|       s &= 255;
#  307|       if (s == 0) s = 1;
#  308|->     memset (buf, (int)s, BLOCKSIZE);
#  309|     }
#  310|     else {                        /* data when random-content=true */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def83]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/sparse-random/sparse-random.c:318:12: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/minmax.h:59:19: note: in definition of macro 'MIN_1'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/unique-name.h:40:37: note: in expansion of macro 'XXUNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/unique-name.h:41:34: note: in expansion of macro 'XUNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/include/minmax.h:51:20: note: in expansion of macro 'NBDKIT_UNIQUE_NAME'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/sparse-random/sparse-random.c:344:18: note: in expansion of macro 'MIN'
#  316|         s = xrandom (&state);
#  317|         s &= 255;
#  318|->       b[i] = s;
#  319|       }
#  320|     }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def84]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/split/split.c: scope_hint: In function 'split_pread'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/split/split.c:258:35: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
#  256|     while (count > 0) {
#  257|       struct file *file = get_file (h, offset);
#  258|->     uint64_t foffs = offset - file->offset;
#  259|       uint64_t max;
#  260|       ssize_t r;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def85]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/split/split.c: scope_hint: In function 'split_pwrite'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/split/split.c:291:35: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
#  289|     while (count > 0) {
#  290|       struct file *file = get_file (h, offset);
#  291|->     uint64_t foffs = offset - file->offset;
#  292|       uint64_t max;
#  293|       ssize_t r;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def86]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/split/split.c: scope_hint: In function 'split_cache'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/split/split.c:322:35: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
#  320|     while (count > 0) {
#  321|       struct file *file = get_file (h, offset);
#  322|->     uint64_t foffs = offset - file->offset;
#  323|       uint64_t max;
#  324|       int r;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def87]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/split/split.c: scope_hint: In function 'split_extents'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/split/split.c:416:35: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
#  414|     while (count > 0) {
#  415|       struct file *file = get_file (h, offset);
#  416|->     uint64_t foffs = offset - file->offset;
#  417|       uint64_t max;
#  418|       int64_t r;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def88]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/tmpdisk/tmpdisk.c: scope_hint: In function 'tmpdisk_open'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/tmpdisk/tmpdisk.c:314:11: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open(disk,  flags)'
#  312|     else
#  313|       flags = O_RDWR | O_CLOEXEC;
#  314|->   h->fd = open (disk, flags);
#  315|     if (h->fd == -1) {
#  316|       nbdkit_error ("open: %s: %m", disk);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def89]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/vddk/reexec.c: scope_hint: In function 'perform_reexec'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/vddk/reexec.c:82:8: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open(&cmdline_file, 524288)'
#   80|      * original argv[].
#   81|      */
#   82|->   fd = open (cmdline_file, O_RDONLY|O_CLOEXEC);
#   83|     if (fd == -1) {
#   84|       /* Not an error. */

Error: GCC_ANALYZER_WARNING (CWE-775): [#def90]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/vddk/reexec.c:92:8: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open(&cmdline_file, 524288)'
#   90|       ssize_t r;
#   91|   
#   92|->     if (string_reserve (&buf, 512) == -1) {
#   93|         nbdkit_error ("realloc: %m");
#   94|         exit (EXIT_FAILURE);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def91]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/vddk/reexec.c:96:41: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open(&cmdline_file, 524288)'
#   94|         exit (EXIT_FAILURE);
#   95|       }
#   96|->     r = read (fd, buf.ptr + buf.len, buf.cap - buf.len);
#   97|       if (r == -1) {
#   98|         nbdkit_error ("read: %s: %m", cmdline_file);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def92]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/vddk/vddk.c: scope_hint: In function 'load_library'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/vddk/vddk.c:449:18: warning[-Wanalyzer-malloc-leak]: leak of 'orig_error'
#  447|       }
#  448|       if (i == 0) {
#  449|->       orig_error = dlerror ();
#  450|         if (orig_error)
#  451|           orig_error = strdup (orig_error);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def93]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/vddk/vddk.c: scope_hint: In function 'vddk_open'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/vddk/vddk.c:674:40: warning[-Wanalyzer-malloc-leak]: leak of 'allocate_connect_params()'
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/cleanup.h:60:3: note: in expansion of macro 'ACQUIRE_LOCK_FOR_CURRENT_SCOPE_1'
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/vddk/vddk.c:704:3: note: in expansion of macro 'ACQUIRE_LOCK_FOR_CURRENT_SCOPE'
#  672|     VixDiskLibConnectParams *ret;
#  673|   
#  674|->   if (VixDiskLib_AllocateConnectParams != NULL) {
#  675|       VDDK_CALL_START (VixDiskLib_AllocateConnectParams, "")
#  676|         ret = VixDiskLib_AllocateConnectParams ();

Error: CPPCHECK_WARNING (CWE-476): [#def94]
nbdkit-1.41.8-build/nbdkit-1.41.8/plugins/vddk/vddk.h:149: error[ctunullpointer]: Null pointer dereference: key
#  147|   };
#  148|   
#  149|-> DEFINE_VECTOR_TYPE (command_queue, struct command *);
#  150|   
#  151|   /* The per-connection handle. */

Error: GCC_ANALYZER_WARNING (CWE-775): [#def95]
nbdkit-1.41.8-build/nbdkit-1.41.8/server/captive.c: scope_hint: In function ‘run_command’
nbdkit-1.41.8-build/nbdkit-1.41.8/server/captive.c:130:8: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(saved_stdin, 0)’
#  128|     if (pid > 0) {              /* Parent process is the run command. */
#  129|       /* Restore original stdin/out */
#  130|->     if (dup2 (saved_stdin, STDIN_FILENO) == -1 ||
#  131|           dup2 (saved_stdout, STDOUT_FILENO) == -1) {
#  132|         r = -1;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def96]
nbdkit-1.41.8-build/nbdkit-1.41.8/server/captive.c:130:48: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(saved_stdout, 1)’
#  128|     if (pid > 0) {              /* Parent process is the run command. */
#  129|       /* Restore original stdin/out */
#  130|->     if (dup2 (saved_stdin, STDIN_FILENO) == -1 ||
#  131|           dup2 (saved_stdout, STDOUT_FILENO) == -1) {
#  132|         r = -1;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def97]
nbdkit-1.41.8-build/nbdkit-1.41.8/server/exports.c: scope_hint: In function ‘nbdkit_add_export’
nbdkit-1.41.8-build/nbdkit-1.41.8/server/exports.c:136:6: warning[-Wanalyzer-malloc-leak]: leak of ‘e.description’
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.h:170:12: note: in definition of macro ‘DEFINE_VECTOR_TYPE’
nbdkit-1.41.8-build/nbdkit-1.41.8/server/exports.c: scope_hint: In function ‘nbdkit_add_export’
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.h:154:3: note: in definition of macro ‘DEFINE_VECTOR_TYPE’
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/cleanup.h:41: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/server/internal.h:52: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/server/exports.c:43: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/server/exports.c:51:1: note: in expansion of macro ‘DEFINE_VECTOR_TYPE’
nbdkit-1.41.8-build/nbdkit-1.41.8/server/exports.c:51:1: note: in expansion of macro ‘DEFINE_VECTOR_TYPE’
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.h:170:12: note: in definition of macro ‘DEFINE_VECTOR_TYPE’
nbdkit-1.41.8-build/nbdkit-1.41.8/server/exports.c: scope_hint: In function ‘nbdkit_add_export’
#  134|     }
#  135|   
#  136|->   if (exports_append (&exps->exports, e) == -1) {
#  137|       nbdkit_error ("nbdkit_add_export: realloc: %m");
#  138|       free (e.name);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def98]
nbdkit-1.41.8-build/nbdkit-1.41.8/server/exports.c:136:7: warning[-Wanalyzer-malloc-leak]: leak of ‘strdup(name)’
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.h:170:12: note: in definition of macro ‘DEFINE_VECTOR_TYPE’
nbdkit-1.41.8-build/nbdkit-1.41.8/server/exports.c: scope_hint: In function ‘nbdkit_add_export’
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.h:154:3: note: in definition of macro ‘DEFINE_VECTOR_TYPE’
nbdkit-1.41.8-build/nbdkit-1.41.8/server/exports.c:51:1: note: in expansion of macro ‘DEFINE_VECTOR_TYPE’
nbdkit-1.41.8-build/nbdkit-1.41.8/server/exports.c:51:1: note: in expansion of macro ‘DEFINE_VECTOR_TYPE’
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.h:170:12: note: in definition of macro ‘DEFINE_VECTOR_TYPE’
nbdkit-1.41.8-build/nbdkit-1.41.8/server/exports.c: scope_hint: In function ‘nbdkit_add_export’
#  134|     }
#  135|   
#  136|->   if (exports_append (&exps->exports, e) == -1) {
#  137|       nbdkit_error ("nbdkit_add_export: realloc: %m");
#  138|       free (e.name);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def99]
nbdkit-1.41.8-build/nbdkit-1.41.8/server/extents.c: scope_hint: In function ‘nbdkit_extents_aligned’
nbdkit-1.41.8-build/nbdkit-1.41.8/server/extents.c:79:13: warning[-Wanalyzer-malloc-leak]: leak of ‘nbdkit_extents_new(*e.offset + *e.length, (long unsigned int)align + offset)’
nbdkit-1.41.8-build/nbdkit-1.41.8/common/utils/vector.h:101: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/server/extents.c:48: included_from: Included from here.
nbdkit-1.41.8-build/nbdkit-1.41.8/server/extents.c:224:11: note: in expansion of macro ‘IS_ALIGNED’
nbdkit-1.41.8-build/nbdkit-1.41.8/server/extents.c: scope_hint: In function ‘nbdkit_extents_aligned’
nbdkit-1.41.8-build/nbdkit-1.41.8/server/extents.c:224:11: note: in expansion of macro ‘IS_ALIGNED’
#   77|     struct nbdkit_extents *r;
#   78|   
#   79|->   if (start > INT64_MAX || end > INT64_MAX) {
#   80|       nbdkit_error ("nbdkit_extents_new: "
#   81|                     "start (%" PRIu64 ") or end (%" PRIu64 ") > INT64_MAX",

Error: GCC_ANALYZER_WARNING (CWE-401): [#def100]
nbdkit-1.41.8-build/nbdkit-1.41.8/server/extents.c: scope_hint: In function ‘nbdkit_extents_full’
nbdkit-1.41.8-build/nbdkit-1.41.8/server/extents.c:79:13: warning[-Wanalyzer-malloc-leak]: leak of ‘nbdkit_extents_new(offset, (long unsigned int)count + offset)’
#   77|     struct nbdkit_extents *r;
#   78|   
#   79|->   if (start > INT64_MAX || end > INT64_MAX) {
#   80|       nbdkit_error ("nbdkit_extents_new: "
#   81|                     "start (%" PRIu64 ") or end (%" PRIu64 ") > INT64_MAX",

Error: GCC_ANALYZER_WARNING (CWE-775): [#def101]
nbdkit-1.41.8-build/nbdkit-1.41.8/server/main.c: scope_hint: In function ‘switch_stdio’
nbdkit-1.41.8-build/nbdkit-1.41.8/server/main.c:1309:6: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/dev/null", 0)’
# 1307|     close (STDIN_FILENO);
# 1308|     close (STDOUT_FILENO);
# 1309|->   if (open ("/dev/null", O_RDONLY) != STDIN_FILENO ||
# 1310|         open ("/dev/null", O_WRONLY) != STDOUT_FILENO) {
# 1311|       perror ("open");

Error: GCC_ANALYZER_WARNING (CWE-775): [#def102]
nbdkit-1.41.8-build/nbdkit-1.41.8/server/main.c:1309:52: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open("/dev/null", 1)’
# 1307|     close (STDIN_FILENO);
# 1308|     close (STDOUT_FILENO);
# 1309|->   if (open ("/dev/null", O_RDONLY) != STDIN_FILENO ||
# 1310|         open ("/dev/null", O_WRONLY) != STDOUT_FILENO) {
# 1311|       perror ("open");

Error: CPPCHECK_WARNING (CWE-401): [#def103]
nbdkit-1.41.8-build/nbdkit-1.41.8/server/sockets.c:402: error[memleak]: Memory leak: thread_data
#  400|     if (unlikely (!thread_data)) {
#  401|       perror ("malloc");
#  402|->     return;
#  403|     }
#  404|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def104]
nbdkit-1.41.8-build/nbdkit-1.41.8/server/threadlocal.c: scope_hint: In function ‘threadlocal_new_server_thread’
nbdkit-1.41.8-build/nbdkit-1.41.8/server/threadlocal.c:109:1: warning[-Wanalyzer-malloc-leak]: leak of ‘threadlocal’
#  107|       exit (EXIT_FAILURE);
#  108|     }
#  109|-> }
#  110|   
#  111|   void

Error: GCC_ANALYZER_WARNING (CWE-476): [#def105]
nbdkit-1.41.8-build/nbdkit-1.41.8/tests/dummy-vddk.c: scope_hint: In function 'VixDiskLib_GetInfo'
nbdkit-1.41.8-build/nbdkit-1.41.8/tests/dummy-vddk.c:178:21: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL '*info'
#  176|   {
#  177|     *info = calloc (1, sizeof (struct VixDiskLibInfo));
#  178|->   (*info)->capacity = CAPACITY;
#  179|     return VIX_OK;
#  180|   }

Scan Properties

analyzer-version-clippy1.82.0
analyzer-version-cppcheck2.16.0
analyzer-version-gcc14.2.1
analyzer-version-gcc-analyzer15.0.0
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-208.us-west-2.compute.internal
mock-configfedora-rawhide-gcc-latest-x86_64
project-namenbdkit-1.41.8-1.fc42
store-results-to/tmp/tmp_mhnp6rp/nbdkit-1.41.8-1.fc42.tar.xz
time-created2024-11-13 02:08:49
time-finished2024-11-13 02:15:58
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmp_mhnp6rp/nbdkit-1.41.8-1.fc42.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmp_mhnp6rp/nbdkit-1.41.8-1.fc42.src.rpm'
tool-versioncsmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9