Ticket #4572: mc-4572-Cleanup-cppcheck-warnings.patch

File mc-4572-Cleanup-cppcheck-warnings.patch, 1.7 KB (added by and, 7 days ago)
  • lib/search/regex.c

    From 52fab474337f1511373d259e4a8ad75aa608937f Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Sun, 15 Dec 2024 09:00:00 +0000
    Subject: [PATCH] Cleanup cppcheck warnings
    
    Make cppcheck happy.
    
    lib/search/regex.c:888:85: error: Uninitialized variable: *error [uninitvar]
            if (pcre2_jit_compile (mc_search_cond->regex_handle, PCRE2_JIT_COMPLETE) && *error != '\0')
                                                                                        ^
    src/vfs/sftpfs/dir.c:95:26: warning: Uninitialized variable: handle [uninitvar]
        sftpfs_dir->handle = handle;
                             ^
    Found by cppcheck-2.16.0
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     lib/search/regex.c   | 2 +-
     src/vfs/sftpfs/dir.c | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/lib/search/regex.c b/lib/search/regex.c
    index 465c3d344..13e3c2650 100644
    a b mc_search__cond_struct_new_init_regex (const char *charset, mc_search_t *lc_mc_s 
    839839 
    840840#ifdef HAVE_PCRE2 
    841841        int errcode; 
    842         char error[BUF_SMALL]; 
     842        char error[BUF_SMALL] = ""; 
    843843        size_t erroffset; 
    844844        int pcre_options = PCRE2_MULTILINE; 
    845845#else 
  • src/vfs/sftpfs/dir.c

    diff --git a/src/vfs/sftpfs/dir.c b/src/vfs/sftpfs/dir.c
    index 34461e28d..a019e8be6 100644
    a b sftpfs_opendir (const vfs_path_t *vpath, GError **mcerror) 
    6868    sftpfs_dir_data_t *sftpfs_dir; 
    6969    sftpfs_super_t *sftpfs_super; 
    7070    const vfs_path_element_t *path_element; 
    71     LIBSSH2_SFTP_HANDLE *handle; 
     71    LIBSSH2_SFTP_HANDLE *handle = NULL; 
    7272    const GString *fixfname; 
    7373 
    7474    if (!sftpfs_op_init (&sftpfs_super, &path_element, vpath, mcerror))