Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-9433

[PATCH] cppcheck reported a number of minor coding errors

Details

    • 5.5.48-0, 5.5.50

    Description

      cppcheck -DDBUG_VOID_RETURN=return -"DDBUG_RETURN(a)=return a"

      {sourcedir}

      Attachments

        Activity

          danblack Daniel Black added a comment -

          [plugin/auth_pam/testing/pam_mariadb_mtr.c:67]: (error) Memory pointed to by 'resp' is freed twice.

          exists in 5.5 - remove free at line 49

          danblack Daniel Black added a comment - [plugin/auth_pam/testing/pam_mariadb_mtr.c:67]: (error) Memory pointed to by 'resp' is freed twice. exists in 5.5 - remove free at line 49
          danblack Daniel Black added a comment -

          [plugin/server_audit/server_audit.c:402]: (error) Invalid number of character '{' when these macros are defined: 'DBUG_VOID_RETURN=return;DBUG_RETURN(a)=return a;HAVE_PSI_INTERFACE'.
          [plugin/server_audit/server_audit.c:402]: (error) Invalid number of character '{' when these macros are defined: 'DBUG_VOID_RETURN=return;DBUG_RETURN(a)=return a;HAVE_PSI_INTERFACE;HUGETLB_USE_PROC_MEMINFO'.
          [plugin/server_audit/server_audit.c:402]: (error) Invalid number of character '{' when these macros are defined: 'DBUG_VOID_RETURN=return;DBUG_RETURN(a)=return a;HAVE_PSI_INTERFACE;USE_ALARM_THREAD'.

          Exists in 5.5 https://github.com/MariaDB/server/blob/5.5/plugin/server_audit/server_audit.c#L541

          Remove second {{

          danblack Daniel Black added a comment - [plugin/server_audit/server_audit.c:402]: (error) Invalid number of character '{' when these macros are defined: 'DBUG_VOID_RETURN=return;DBUG_RETURN(a)=return a;HAVE_PSI_INTERFACE'. [plugin/server_audit/server_audit.c:402]: (error) Invalid number of character '{' when these macros are defined: 'DBUG_VOID_RETURN=return;DBUG_RETURN(a)=return a;HAVE_PSI_INTERFACE;HUGETLB_USE_PROC_MEMINFO'. [plugin/server_audit/server_audit.c:402]: (error) Invalid number of character '{' when these macros are defined: 'DBUG_VOID_RETURN=return;DBUG_RETURN(a)=return a;HAVE_PSI_INTERFACE;USE_ALARM_THREAD'. Exists in 5.5 https://github.com/MariaDB/server/blob/5.5/plugin/server_audit/server_audit.c#L541 Remove second {{
          danblack Daniel Black added a comment -

          [mysys/mf_iocache.c:1929]: (error) va_list 'va_args' was opened but not closed by va_end().

          to fix - mariadb-5.5

          upstream: https://github.com/mysql/mysql-server/pull/48

          danblack Daniel Black added a comment - [mysys/mf_iocache.c:1929]: (error) va_list 'va_args' was opened but not closed by va_end(). to fix - mariadb-5.5 upstream: https://github.com/mysql/mysql-server/pull/48
          danblack Daniel Black added a comment -

          False positives/noise:

          [client/mysqlbinlog.cc:536]: (error) Memory pointed to by 'ce' is freed twice.
          [extra/innochecksum.cc:995]: (error) Used file that is not opened.
          [client/mysqltest.cc:2647]: (error) Possible null pointer dereference: query_end
          [client/mysqltest.cc:2649]: (error) Possible null pointer dereference: query_end
          [client/mysqltest.cc:2975]: (error) Possible null pointer dereference: p_end
          [client/mysqltest.cc:2983]: (error) Possible null pointer dereference: p_end
          [client/mysqltest.cc:3008]: (error) Possible null pointer dereference: p_end
          [extra/readline/complete.c:1007]: (error) Address of local auto-variable assigned to a function parameter.
          [client/mysqltest.cc:1576]: (error) va_list 'args' was opened but not closed by va_end().
          [extra/readline/input.c:261]: (error) Uninitialized variable: input
          [extra/readline/tilde.c:354]: (error) Allocation with xmalloc, strcpy doesn't release it.
          [extra/yassl/examples/echoserver/echoserver.cpp:166]: (error) Resource leak: fout
          [mysys/mf_keycache.c:2512]: (error) Resource handle 'keycache_debug_log' freed twice.
          [mysys/mf_keycache.c:2579]: (error) Resource handle 'keycache_debug_log' freed twice.
          [mysys/mf_keycache.c:2581]: (error) Resource handle 'keycache_debug_log' freed twice.

          needs investigation:

          [sql/create_options.cc:366]: (error) Memory leak: val
          [sql/create_options.cc:711]: (error) Memory leak: ptr

          danblack Daniel Black added a comment - False positives/noise: [client/mysqlbinlog.cc:536]: (error) Memory pointed to by 'ce' is freed twice. [extra/innochecksum.cc:995]: (error) Used file that is not opened. [client/mysqltest.cc:2647]: (error) Possible null pointer dereference: query_end [client/mysqltest.cc:2649]: (error) Possible null pointer dereference: query_end [client/mysqltest.cc:2975]: (error) Possible null pointer dereference: p_end [client/mysqltest.cc:2983]: (error) Possible null pointer dereference: p_end [client/mysqltest.cc:3008]: (error) Possible null pointer dereference: p_end [extra/readline/complete.c:1007]: (error) Address of local auto-variable assigned to a function parameter. [client/mysqltest.cc:1576]: (error) va_list 'args' was opened but not closed by va_end(). [extra/readline/input.c:261]: (error) Uninitialized variable: input [extra/readline/tilde.c:354]: (error) Allocation with xmalloc, strcpy doesn't release it. [extra/yassl/examples/echoserver/echoserver.cpp:166]: (error) Resource leak: fout [mysys/mf_keycache.c:2512]: (error) Resource handle 'keycache_debug_log' freed twice. [mysys/mf_keycache.c:2579]: (error) Resource handle 'keycache_debug_log' freed twice. [mysys/mf_keycache.c:2581]: (error) Resource handle 'keycache_debug_log' freed twice. needs investigation: [sql/create_options.cc:366]: (error) Memory leak: val [sql/create_options.cc:711]: (error) Memory leak: ptr

          Hi Daniel!

          We appreciate your contributions. I have investigated each one of the reported warnings.

          In order of their appearance:
          Pull requests have been merged.

          • [plugin/auth_pam/testing/pam_mariadb_mtr.c:67]: (error) Memory pointed to by 'resp' is freed twice
            This is a false warning. Resp gets allocated again after the free call at line 49.
          • [plugin/server_audit/server_audit.c:402]: (error) Invalid number of character '{' when these macros are defined:
            This was handled by holyfoot a while ago.
          • [mysys/mf_iocache.c:1929]: (error) va_list 'va_args' was opened but not closed by va_end().
            Patch applied
          • [sql/create_options.cc:366]: (error) Memory leak: val
            Not a bug

          Thanks again for all the help!

          cvicentiu Vicențiu Ciorbaru added a comment - Hi Daniel! We appreciate your contributions. I have investigated each one of the reported warnings. In order of their appearance: Pull requests have been merged. [plugin/auth_pam/testing/pam_mariadb_mtr.c:67] : (error) Memory pointed to by 'resp' is freed twice This is a false warning. Resp gets allocated again after the free call at line 49. [plugin/server_audit/server_audit.c:402] : (error) Invalid number of character '{' when these macros are defined: This was handled by holyfoot a while ago. [mysys/mf_iocache.c:1929] : (error) va_list 'va_args' was opened but not closed by va_end(). Patch applied [sql/create_options.cc:366] : (error) Memory leak: val Not a bug Thanks again for all the help!

          Pull requests merged.

          cvicentiu Vicențiu Ciorbaru added a comment - Pull requests merged.

          People

            cvicentiu Vicențiu Ciorbaru
            danblack Daniel Black
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.