[MDEV-9433] [PATCH] cppcheck reported a number of minor coding errors Created: 2016-01-19  Updated: 2016-06-20  Resolved: 2016-06-14

Status: Closed
Project: MariaDB Server
Component/s: Compiling
Affects Version/s: 5.5.47, 10.0.23, 10.1.10
Fix Version/s: 5.5.50

Type: Bug Priority: Major
Reporter: Daniel Black Assignee: Vicențiu Ciorbaru
Resolution: Fixed Votes: 0
Labels: contribution, patch

Attachments: File mariadb-server-67cf76a.log    
Sprint: 5.5.48-0, 5.5.50

 Description   

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

{sourcedir}

 Comments   
Comment by Daniel Black [ 2016-01-20 ]

[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

Comment by Daniel Black [ 2016-01-20 ]

[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 {{

Comment by Daniel Black [ 2016-01-20 ]

[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

Comment by Daniel Black [ 2016-01-20 ]

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

Comment by Vicențiu Ciorbaru [ 2016-06-13 ]

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!

Comment by Vicențiu Ciorbaru [ 2016-06-14 ]

Pull requests merged.

Generated at Thu Feb 08 07:34:38 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.