ed-1.22.2-1.fc44

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1]
ed-1.22.2/buffer.c:478:10: warning[-Wanalyzer-malloc-leak]: leak of ‘dup_line_node(0)’
ed-1.22.2/buffer.c:446:14: enter_function: entry to ‘put_sbuf_line’
ed-1.22.2/buffer.c:449:5: branch_false: following ‘false’ branch (when ‘p’ is non-NULL)...
ed-1.22.2/buffer.c:452:19: branch_false: ...to here
ed-1.22.2/buffer.c:453:7: call_function: inlined call to ‘too_many_lines’ from ‘put_sbuf_line’
ed-1.22.2/buffer.c:455:7: branch_true: ...to here
ed-1.22.2/buffer.c:466:5: branch_false: following ‘false’ branch...
ed-1.22.2/buffer.c:473:20: branch_false: ...to here
ed-1.22.2/buffer.c:473:20: call_function: calling ‘dup_line_node’ from ‘put_sbuf_line’
ed-1.22.2/buffer.c:473:20: return_function: returning to ‘put_sbuf_line’ from ‘dup_line_node’
ed-1.22.2/buffer.c:474:5: branch_false: following ‘false’ branch...
ed-1.22.2/buffer.c:475:3: branch_false: ...to here
ed-1.22.2/buffer.c:476:3: call_function: calling ‘add_line_node’ from ‘put_sbuf_line’
#  476|     add_line_node( lp );
#  477|     sfpos += len;				/* update file position */
#  478|->   return p + 1;
#  479|     }
#  480|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def2]
ed-1.22.2/buffer.c:488:3: warning[-Wanalyzer-malloc-leak]: leak of ‘dup_line_node(lp)’
ed-1.22.2/buffer.c:412:6: enter_function: entry to ‘put_lines’
ed-1.22.2/buffer.c:417:5: branch_false: following ‘false’ branch...
ed-1.22.2/buffer.c:419:3: branch_false: ...to here
ed-1.22.2/buffer.c:420:10: branch_true: following ‘true’ branch...
ed-1.22.2/buffer.c:422:9: call_function: inlined call to ‘too_many_lines’ from ‘put_lines’
ed-1.22.2/buffer.c:423:5: branch_true: ...to here
ed-1.22.2/buffer.c:424:21: call_function: calling ‘dup_line_node’ from ‘put_lines’
ed-1.22.2/buffer.c:424:21: return_function: returning to ‘put_lines’ from ‘dup_line_node’
ed-1.22.2/buffer.c:425:7: branch_false: following ‘false’ branch...
ed-1.22.2/buffer.c:426:5: branch_false: ...to here
ed-1.22.2/buffer.c:426:5: call_function: calling ‘add_line_node’ from ‘put_lines’
#  486|     static int o_addr = 0;
#  487|   
#  488|->   disable_interrupts();
#  489|     if( o_addr < addr )
#  490|       {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def3]
ed-1.22.2/buffer.c:488:3: warning[-Wanalyzer-malloc-leak]: leak of ‘dup_line_node(np)’
ed-1.22.2/buffer.c:192:6: enter_function: entry to ‘copy_lines’
ed-1.22.2/buffer.c:205:10: branch_true: following ‘true’ branch (when ‘n > 0’)...
 branch_true: ...to here
ed-1.22.2/buffer.c:206:12: branch_true: following ‘true’ branch (when ‘n != 0’)...
ed-1.22.2/buffer.c:208:11: call_function: inlined call to ‘too_many_lines’ from ‘copy_lines’
ed-1.22.2/buffer.c:209:7: branch_true: ...to here
ed-1.22.2/buffer.c:210:24: call_function: calling ‘dup_line_node’ from ‘copy_lines’
ed-1.22.2/buffer.c:210:24: return_function: returning to ‘copy_lines’ from ‘dup_line_node’
ed-1.22.2/buffer.c:211:9: branch_false: following ‘false’ branch...
ed-1.22.2/buffer.c:212:7: branch_false: ...to here
ed-1.22.2/buffer.c:212:7: call_function: calling ‘add_line_node’ from ‘copy_lines’
#  486|     static int o_addr = 0;
#  487|   
#  488|->   disable_interrupts();
#  489|     if( o_addr < addr )
#  490|       {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def4]
ed-1.22.2/buffer.c:504:3: warning[-Wanalyzer-malloc-leak]: leak of ‘dup_line_node(lp)’
ed-1.22.2/buffer.c:412:6: enter_function: entry to ‘put_lines’
ed-1.22.2/buffer.c:417:5: branch_false: following ‘false’ branch...
ed-1.22.2/buffer.c:419:3: branch_false: ...to here
ed-1.22.2/buffer.c:420:10: branch_true: following ‘true’ branch...
ed-1.22.2/buffer.c:422:9: call_function: inlined call to ‘too_many_lines’ from ‘put_lines’
ed-1.22.2/buffer.c:423:5: branch_true: ...to here
ed-1.22.2/buffer.c:424:21: call_function: calling ‘dup_line_node’ from ‘put_lines’
ed-1.22.2/buffer.c:424:21: return_function: returning to ‘put_lines’ from ‘dup_line_node’
ed-1.22.2/buffer.c:425:7: branch_false: following ‘false’ branch...
ed-1.22.2/buffer.c:426:5: branch_false: ...to here
ed-1.22.2/buffer.c:426:5: call_function: calling ‘add_line_node’ from ‘put_lines’
#  502|       { lp = &buffer_head; o_addr = 0;
#  503|         while( o_addr < addr ) { ++o_addr; lp = lp->q_forw; } }
#  504|->   enable_interrupts();
#  505|     return lp;
#  506|     }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def5]
ed-1.22.2/buffer.c:504:3: warning[-Wanalyzer-malloc-leak]: leak of ‘dup_line_node(np)’
ed-1.22.2/buffer.c:192:6: enter_function: entry to ‘copy_lines’
ed-1.22.2/buffer.c:205:10: branch_true: following ‘true’ branch (when ‘n > 0’)...
 branch_true: ...to here
ed-1.22.2/buffer.c:206:12: branch_true: following ‘true’ branch (when ‘n != 0’)...
ed-1.22.2/buffer.c:208:11: call_function: inlined call to ‘too_many_lines’ from ‘copy_lines’
ed-1.22.2/buffer.c:209:7: branch_true: ...to here
ed-1.22.2/buffer.c:210:24: call_function: calling ‘dup_line_node’ from ‘copy_lines’
ed-1.22.2/buffer.c:210:24: return_function: returning to ‘copy_lines’ from ‘dup_line_node’
ed-1.22.2/buffer.c:211:9: branch_false: following ‘false’ branch...
ed-1.22.2/buffer.c:212:7: branch_false: ...to here
ed-1.22.2/buffer.c:212:7: call_function: calling ‘add_line_node’ from ‘copy_lines’
#  502|       { lp = &buffer_head; o_addr = 0;
#  503|         while( o_addr < addr ) { ++o_addr; lp = lp->q_forw; } }
#  504|->   enable_interrupts();
#  505|     return lp;
#  506|     }

Error: GCC_ANALYZER_WARNING (CWE-457): [#def6]
ed-1.22.2/carg_parser.c:100:3: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘s2’
ed-1.22.2/carg_parser.c:217:6: enter_function: entry to ‘ap_init’
ed-1.22.2/carg_parser.c:229:5: branch_false: following ‘false’ branch...
ed-1.22.2/carg_parser.c:231:10: branch_true: following ‘true’ branch...
ed-1.22.2/carg_parser.c:233:35: branch_true: ...to here
ed-1.22.2/carg_parser.c:236:7: branch_true: following ‘true’ branch...
ed-1.22.2/carg_parser.c:239:34: branch_true: ...to here
ed-1.22.2/carg_parser.c:239:32: branch_false: following ‘false’ branch...
ed-1.22.2/carg_parser.c:240:9: branch_false: ...to here
ed-1.22.2/carg_parser.c:240:9: branch_false: following ‘false’ branch (when ‘ch2 != 45’)...
ed-1.22.2/carg_parser.c:245:17: branch_false: ...to here
ed-1.22.2/carg_parser.c:245:17: call_function: calling ‘parse_short_option’ from ‘ap_init’
#   98|     ap->error = (char *)tmp;
#   99|     memcpy( ap->error, s1, l1 );
#  100|->   memcpy( ap->error + l1, s2, l2 );
#  101|     memcpy( ap->error + l1 + l2, s3, l3 + 1 );
#  102|     return 1;

Error: GCC_ANALYZER_WARNING (CWE-131): [#def7]
ed-1.22.2/global.c:73:5: warning[-Wanalyzer-allocation-size]: allocated buffer size is not a multiple of the pointee's size
ed-1.22.2/global.c:59:5: branch_true: following ‘true’ branch...
ed-1.22.2/global.c:61:7: branch_true: ...to here
ed-1.22.2/global.c:61:7: branch_false: following ‘false’ branch (when ‘min_size <= 2147483646’)...
ed-1.22.2/global.c:63:26: branch_false: ...to here
ed-1.22.2/global.c:67:7: branch_true: following ‘true’ branch...
ed-1.22.2/global.c:67:33: branch_true: ...to here
ed-1.22.2/global.c:69:7: branch_false: following ‘false’ branch (when ‘new_buf’ is non-NULL)...
ed-1.22.2/global.c:72:5: branch_false: ...to here
ed-1.22.2/global.c:73:5: danger: allocated ‘(const int)active_size’ bytes and assigned to ‘const line_node **’ here; ‘sizeof (const line_node *)’ is ‘8’
#   71|           set_error_msg( mem_msg ); enable_interrupts(); return false; }
#   72|       active_size = new_size;
#   73|->     active_list = (const line_node **)new_buf;
#   74|       enable_interrupts();
#   75|       }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def8]
ed-1.22.2/io.c:39:33: warning[-Wanalyzer-malloc-leak]: leak of ‘fp’
ed-1.22.2/io.c:288:5: enter_function: entry to ‘read_file’
ed-1.22.2/io.c:294:5: branch_true: following ‘true’ branch...
ed-1.22.2/io.c:294:31: branch_true: ...to here
ed-1.22.2/io.c:294:31: acquire_memory: allocated here
ed-1.22.2/io.c:298:5: branch_false: following ‘false’ branch (when ‘fp’ is non-NULL)...
ed-1.22.2/io.c:301:21: branch_false: ...to here
ed-1.22.2/io.c:301:21: call_function: calling ‘read_stream’ from ‘read_file’
#   37|   static bool unterminated_last_line( void )
#   38|     { return unterminated_line != 0 &&
#   39|->            unterminated_line == search_line_node( last_addr() ); }
#   40|   
#   41|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def9]
ed-1.22.2/io.c:39:51: warning[-Wanalyzer-malloc-leak]: leak of ‘fp’
ed-1.22.2/io.c:288:5: enter_function: entry to ‘read_file’
ed-1.22.2/io.c:294:5: branch_true: following ‘true’ branch...
ed-1.22.2/io.c:294:31: branch_true: ...to here
ed-1.22.2/io.c:294:31: acquire_memory: allocated here
ed-1.22.2/io.c:298:5: branch_false: following ‘false’ branch (when ‘fp’ is non-NULL)...
ed-1.22.2/io.c:301:21: branch_false: ...to here
ed-1.22.2/io.c:301:21: call_function: calling ‘read_stream’ from ‘read_file’
#   37|   static bool unterminated_last_line( void )
#   38|     { return unterminated_line != 0 &&
#   39|->            unterminated_line == search_line_node( last_addr() ); }
#   40|   
#   41|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def10]
ed-1.22.2/io.c:209:10: warning[-Wanalyzer-malloc-leak]: leak of ‘fp’
ed-1.22.2/io.c:288:5: enter_function: entry to ‘read_file’
ed-1.22.2/io.c:294:5: branch_true: following ‘true’ branch...
ed-1.22.2/io.c:294:31: branch_true: ...to here
ed-1.22.2/io.c:294:31: acquire_memory: allocated here
ed-1.22.2/io.c:298:5: branch_false: following ‘false’ branch (when ‘fp’ is non-NULL)...
ed-1.22.2/io.c:301:21: branch_false: ...to here
ed-1.22.2/io.c:301:21: call_function: calling ‘read_stream’ from ‘read_file’
#  207|     while( true )
#  208|       {
#  209|->     if( !resize_buffer( &buf, &bufsz, i + 2 ) ) return 0;
#  210|       c = getc( fp ); if( c == EOF ) break;
#  211|       buf[i++] = c;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def11]
ed-1.22.2/io.c:212:18: warning[-Wanalyzer-malloc-leak]: leak of ‘fp’
ed-1.22.2/io.c:288:5: enter_function: entry to ‘read_file’
ed-1.22.2/io.c:294:5: branch_true: following ‘true’ branch...
ed-1.22.2/io.c:294:31: branch_true: ...to here
ed-1.22.2/io.c:294:31: acquire_memory: allocated here
ed-1.22.2/io.c:298:5: branch_false: following ‘false’ branch (when ‘fp’ is non-NULL)...
ed-1.22.2/io.c:301:21: branch_false: ...to here
ed-1.22.2/io.c:301:21: call_function: calling ‘read_stream’ from ‘read_file’
#  210|       c = getc( fp ); if( c == EOF ) break;
#  211|       buf[i++] = c;
#  212|->     if( c == 0 ) set_binary();
#  213|       else if( c == '\n' )		/* remove CR only from CR/LF pairs */
#  214|         { if( strip_cr() && i > 1 && buf[i-2] == '\r' ) { buf[i-2] = '\n'; --i; }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def12]
ed-1.22.2/io.c:243:20: warning[-Wanalyzer-malloc-leak]: leak of ‘fp’
ed-1.22.2/io.c:288:5: enter_function: entry to ‘read_file’
ed-1.22.2/io.c:294:5: branch_true: following ‘true’ branch...
ed-1.22.2/io.c:294:31: branch_true: ...to here
ed-1.22.2/io.c:294:31: acquire_memory: allocated here
ed-1.22.2/io.c:298:5: branch_false: following ‘false’ branch (when ‘fp’ is non-NULL)...
ed-1.22.2/io.c:301:21: branch_false: ...to here
ed-1.22.2/io.c:301:21: call_function: calling ‘read_stream’ from ‘read_file’
#  241|                            const int addr )
#  242|     {
#  243|->   line_node * lp = search_line_node( addr );
#  244|     undo_atom * up = 0;
#  245|     long total_size = 0;		/* number of bytes read */

Error: GCC_ANALYZER_WARNING (CWE-401): [#def13]
ed-1.22.2/io.c:246:27: warning[-Wanalyzer-malloc-leak]: leak of ‘fp’
ed-1.22.2/io.c:288:5: enter_function: entry to ‘read_file’
ed-1.22.2/io.c:294:5: branch_true: following ‘true’ branch...
ed-1.22.2/io.c:294:31: branch_true: ...to here
ed-1.22.2/io.c:294:31: acquire_memory: allocated here
ed-1.22.2/io.c:298:5: branch_false: following ‘false’ branch (when ‘fp’ is non-NULL)...
ed-1.22.2/io.c:301:21: branch_false: ...to here
ed-1.22.2/io.c:301:21: call_function: calling ‘read_stream’ from ‘read_file’
#  244|     undo_atom * up = 0;
#  245|     long total_size = 0;		/* number of bytes read */
#  246|->   const bool o_isbinary = isbinary();
#  247|     const bool appended = ( addr == last_addr() );
#  248|     const bool o_unterminated_last_line = unterminated_last_line();

Error: GCC_ANALYZER_WARNING (CWE-401): [#def14]
ed-1.22.2/io.c:247:35: warning[-Wanalyzer-malloc-leak]: leak of ‘fp’
ed-1.22.2/io.c:288:5: enter_function: entry to ‘read_file’
ed-1.22.2/io.c:294:5: branch_true: following ‘true’ branch...
ed-1.22.2/io.c:294:31: branch_true: ...to here
ed-1.22.2/io.c:294:31: acquire_memory: allocated here
ed-1.22.2/io.c:298:5: branch_false: following ‘false’ branch (when ‘fp’ is non-NULL)...
ed-1.22.2/io.c:301:21: branch_false: ...to here
ed-1.22.2/io.c:301:21: call_function: calling ‘read_stream’ from ‘read_file’
#  245|     long total_size = 0;		/* number of bytes read */
#  246|     const bool o_isbinary = isbinary();
#  247|->   const bool appended = ( addr == last_addr() );
#  248|     const bool o_unterminated_last_line = unterminated_last_line();
#  249|     bool newline_added = false;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def15]
ed-1.22.2/io.c:251:3: warning[-Wanalyzer-malloc-leak]: leak of ‘fp’
ed-1.22.2/io.c:288:5: enter_function: entry to ‘read_file’
ed-1.22.2/io.c:294:5: branch_true: following ‘true’ branch...
ed-1.22.2/io.c:294:31: branch_true: ...to here
ed-1.22.2/io.c:294:31: acquire_memory: allocated here
ed-1.22.2/io.c:298:5: branch_false: following ‘false’ branch (when ‘fp’ is non-NULL)...
ed-1.22.2/io.c:301:21: branch_false: ...to here
ed-1.22.2/io.c:301:21: call_function: calling ‘read_stream’ from ‘read_file’
#  249|     bool newline_added = false;
#  250|   
#  251|->   set_current_addr( addr );
#  252|     while( true )
#  253|       {

Error: GCC_ANALYZER_WARNING (CWE-775): [#def16]
ed-1.22.2/io.c:296:62: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(filename, "r")’
ed-1.22.2/io.c:294:5: branch_false: following ‘false’ branch...
ed-1.22.2/io.c:295:20: branch_false: ...to here
ed-1.22.2/io.c:295:10: branch_true: following ‘true’ branch...
ed-1.22.2/io.c:296:19: acquire_resource: opened here
ed-1.22.2/io.c:295:12: branch_true: following ‘true’ branch...
ed-1.22.2/io.c:295:12: branch_true: ...to here
ed-1.22.2/io.c:295:12: branch_true: following ‘true’ branch (when ‘read_onlyp’ is non-NULL)...
ed-1.22.2/io.c:296:62: branch_true: ...to here
ed-1.22.2/io.c:296:62: danger: ‘fopen(filename, "r")’ leaks here; was opened at [(5)](sarif:/runs/0/results/10/codeFlows/0/threadFlows/0/locations/4)
#  294|     if( *filename == '!' ) fp = popen( filename + 1, "r" );
#  295|     else if( !( fp = fopen( filename, "r+" ) ) && errno != ENOENT &&
#  296|->            ( fp = fopen( filename, "r" ) ) && read_onlyp && !modified() )
#  297|       *read_onlyp = true;
#  298|     if( !fp )

Error: GCC_ANALYZER_WARNING (CWE-401): [#def17]
ed-1.22.2/io.c:296:62: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(filename, "r")’
ed-1.22.2/io.c:294:5: branch_false: following ‘false’ branch...
ed-1.22.2/io.c:295:20: branch_false: ...to here
ed-1.22.2/io.c:295:10: branch_true: following ‘true’ branch...
ed-1.22.2/io.c:296:19: acquire_memory: allocated here
ed-1.22.2/io.c:295:12: branch_true: following ‘true’ branch...
ed-1.22.2/io.c:295:12: branch_true: ...to here
ed-1.22.2/io.c:295:12: branch_true: following ‘true’ branch (when ‘read_onlyp’ is non-NULL)...
ed-1.22.2/io.c:296:62: branch_true: ...to here
ed-1.22.2/io.c:296:62: danger: ‘fopen(filename, "r")’ leaks here; was allocated at [(5)](sarif:/runs/0/results/11/codeFlows/0/threadFlows/0/locations/4)
#  294|     if( *filename == '!' ) fp = popen( filename + 1, "r" );
#  295|     else if( !( fp = fopen( filename, "r+" ) ) && errno != ENOENT &&
#  296|->            ( fp = fopen( filename, "r" ) ) && read_onlyp && !modified() )
#  297|       *read_onlyp = true;
#  298|     if( !fp )

Error: GCC_ANALYZER_WARNING (CWE-401): [#def18]
ed-1.22.2/io.c:318:20: warning[-Wanalyzer-malloc-leak]: leak of ‘fp’
ed-1.22.2/io.c:346:5: enter_function: entry to ‘write_file’
ed-1.22.2/io.c:352:5: branch_true: following ‘true’ branch...
ed-1.22.2/io.c:352:31: branch_true: ...to here
ed-1.22.2/io.c:352:31: acquire_memory: allocated here
ed-1.22.2/io.c:354:5: branch_false: following ‘false’ branch (when ‘fp’ is non-NULL)...
ed-1.22.2/io.c:357:21: branch_false: ...to here
ed-1.22.2/io.c:357:21: call_function: calling ‘write_stream’ from ‘write_file’
#  316|                             int from, const int to )
#  317|     {
#  318|->   line_node * lp = search_line_node( from );
#  319|     long size = 0;		/* number of bytes written */
#  320|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def19]
ed-1.22.2/io.c:324:16: warning[-Wanalyzer-malloc-leak]: leak of ‘fp’
ed-1.22.2/io.c:346:5: enter_function: entry to ‘write_file’
ed-1.22.2/io.c:352:5: branch_true: following ‘true’ branch...
ed-1.22.2/io.c:352:31: branch_true: ...to here
ed-1.22.2/io.c:352:31: acquire_memory: allocated here
ed-1.22.2/io.c:354:5: branch_false: following ‘false’ branch (when ‘fp’ is non-NULL)...
ed-1.22.2/io.c:357:21: branch_false: ...to here
ed-1.22.2/io.c:357:21: call_function: calling ‘write_stream’ from ‘write_file’
#  322|       {
#  323|       int len;
#  324|->     char * p = get_sbuf_line( lp );
#  325|       if( !p ) return -1;
#  326|       len = lp->len;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def20]
ed-1.22.2/io.c:327:17: warning[-Wanalyzer-malloc-leak]: leak of ‘fp’
ed-1.22.2/io.c:346:5: enter_function: entry to ‘write_file’
ed-1.22.2/io.c:352:5: branch_true: following ‘true’ branch...
ed-1.22.2/io.c:352:31: branch_true: ...to here
ed-1.22.2/io.c:352:31: acquire_memory: allocated here
ed-1.22.2/io.c:354:5: branch_false: following ‘false’ branch (when ‘fp’ is non-NULL)...
ed-1.22.2/io.c:357:21: branch_false: ...to here
ed-1.22.2/io.c:357:21: call_function: calling ‘write_stream’ from ‘write_file’
#  325|       if( !p ) return -1;
#  326|       len = lp->len;
#  327|->     if( from != last_addr() || !isbinary() || !unterminated_last_line() )
#  328|         p[len++] = '\n';
#  329|       size += len;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def21]
ed-1.22.2/io.c:327:33: warning[-Wanalyzer-malloc-leak]: leak of ‘fp’
ed-1.22.2/io.c:346:5: enter_function: entry to ‘write_file’
ed-1.22.2/io.c:352:5: branch_true: following ‘true’ branch...
ed-1.22.2/io.c:352:31: branch_true: ...to here
ed-1.22.2/io.c:352:31: acquire_memory: allocated here
ed-1.22.2/io.c:354:5: branch_false: following ‘false’ branch (when ‘fp’ is non-NULL)...
ed-1.22.2/io.c:357:21: branch_false: ...to here
ed-1.22.2/io.c:357:21: call_function: calling ‘write_stream’ from ‘write_file’
#  325|       if( !p ) return -1;
#  326|       len = lp->len;
#  327|->     if( from != last_addr() || !isbinary() || !unterminated_last_line() )
#  328|         p[len++] = '\n';
#  329|       size += len;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def22]
ed-1.22.2/io.c:333:9: warning[-Wanalyzer-malloc-leak]: leak of ‘fp’
ed-1.22.2/io.c:346:5: enter_function: entry to ‘write_file’
ed-1.22.2/io.c:352:5: branch_true: following ‘true’ branch...
ed-1.22.2/io.c:352:31: branch_true: ...to here
ed-1.22.2/io.c:352:31: acquire_memory: allocated here
ed-1.22.2/io.c:354:5: branch_false: following ‘false’ branch (when ‘fp’ is non-NULL)...
ed-1.22.2/io.c:357:21: branch_false: ...to here
ed-1.22.2/io.c:357:21: call_function: calling ‘write_stream’ from ‘write_file’
#  331|         if( fputc( *p++, fp ) == EOF )
#  332|           {
#  333|->         show_strerror( filename, errno );
#  334|           set_error_msg( "Cannot write file" );
#  335|           return -1;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def23]
ed-1.22.2/io.c:334:9: warning[-Wanalyzer-malloc-leak]: leak of ‘fp’
ed-1.22.2/io.c:346:5: enter_function: entry to ‘write_file’
ed-1.22.2/io.c:352:5: branch_true: following ‘true’ branch...
ed-1.22.2/io.c:352:31: branch_true: ...to here
ed-1.22.2/io.c:352:31: acquire_memory: allocated here
ed-1.22.2/io.c:354:5: branch_false: following ‘false’ branch (when ‘fp’ is non-NULL)...
ed-1.22.2/io.c:357:21: branch_false: ...to here
ed-1.22.2/io.c:357:21: call_function: calling ‘write_stream’ from ‘write_file’
#  332|           {
#  333|           show_strerror( filename, errno );
#  334|->         set_error_msg( "Cannot write file" );
#  335|           return -1;
#  336|           }

Scan Properties

analyzer-version-clippy1.90.0
analyzer-version-cppcheck2.18.3
analyzer-version-gcc15.2.1
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-gcc-latest-x86_64
project-nameed-1.22.2-1.fc44
store-results-to/tmp/tmpcvp928be/ed-1.22.2-1.fc44.tar.xz
time-created2025-10-28 17:43:23
time-finished2025-10-28 17:44:36
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'gcc,cppcheck,shellcheck,clippy,unicontrol' '-o' '/tmp/tmpcvp928be/ed-1.22.2-1.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmpcvp928be/ed-1.22.2-1.fc44.src.rpm'
tool-versioncsmock-3.8.3.20251027.143044.ge6b947b-1.el9