Ticket #4572: mc-4572-fix-garbage-return-value-message.patch

File mc-4572-fix-garbage-return-value-message.patch, 1.5 KB (added by and, 3 days ago)
  • lib/widget/wtools.c

    From 1ece5b341f5db7f9e098ce60c660672f0c6c7b4c Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Wed, 18 Dec 2024 14:00:00 +0000
    Subject: [PATCH] fix Garbage return value warning
    
    Make Static Analyzer happy.
    
    Bug Group   Bug Type              File                     Function/Method       Line
    Logic error Garbage return value  src/filemanager/boxes.c  cd_box                1236
    Logic error Garbage return value  lib/widget/wtools.c      fg_input_dialog_help  198
    
    Found by Clang-19 Static Analyzer
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     lib/widget/wtools.c     | 2 +-
     src/filemanager/boxes.c | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/lib/widget/wtools.c b/lib/widget/wtools.c
    index b0a31c76a..040417ab5 100644
    a b fg_input_dialog_help (const char *header, const char *text, const char *help, 
    154154    char *p_text; 
    155155    char histname[64] = "inp|"; 
    156156    gboolean is_passwd = FALSE; 
    157     char *my_str; 
     157    char *my_str = NULL; 
    158158    int ret; 
    159159 
    160160    /* label text */ 
  • src/filemanager/boxes.c

    diff --git a/src/filemanager/boxes.c b/src/filemanager/boxes.c
    index 279926690..6c7f0cda2 100644
    a b char * 
    12181218cd_box (const WPanel *panel) 
    12191219{ 
    12201220    const Widget *w = CONST_WIDGET (panel); 
    1221     char *my_str; 
     1221    char *my_str = NULL; 
    12221222 
    12231223    quick_widget_t quick_widgets[] = { 
    12241224        QUICK_LABELED_INPUT (N_("cd"), input_label_left, "", "input", &my_str, NULL, FALSE, TRUE,