[asterisk-bugs] [JIRA] (ASTERISK-27793) cppcheck identifies redundant "if"

Ilya Shipitsin (JIRA) noreply at issues.asterisk.org
Wed Apr 18 05:36:50 CDT 2018


    [ https://issues.asterisk.org/jira/browse/ASTERISK-27793?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=243070#comment-243070 ] 

Ilya Shipitsin edited comment on ASTERISK-27793 at 4/18/18 5:35 AM:
--------------------------------------------------------------------

there are several interesting findings left, I'll address them in another patch. commit and close this issue



```
# grep '(error' typescript | grep -v 'Uninitialized variable'
[addons/ooh323c/src/ooq931.c:507]: (error) Shifting 64-bit value by 64 bits is undefined behaviour
[channels/console_video.c:860]: (error) Invalid number of character '{' when these macros are defined: 'HAVE_FFMPEG;HAVE_VIDEO_CONSOLE'.
[ast_expr2.c:2329]: (error) Memory allocation size is negative.
[ast_expr2.c:2329]: (error) Invalid malloc() argument nr 1. The value is -1 but the valid values are '0:'.
[main/bridge_channel.c:1707]: (error) Null pointer dereference: hook
[menuselect/menuselect_curses.c:230]: (error) Undefined behavior: Variable 'buf' is used as parameter and destination in s[n]printf().
[menuselect/menuselect_gtk.c:110]: (error) Buffer is accessed out of bounds.
[ael.tab.c:3591]: (error) Invalid number of character '{' when no macros are defined.
[ael.tab.c:3591]: (error) Invalid number of character '{' when these macros are defined: 'AAL_ARGCHECK'.
[ael.tab.c:3591]: (error) Invalid number of character '{' when these macros are defined: 'ENABLE_NLS;YYENABLE_NLS'.
[ael.tab.c:3591]: (error) Invalid number of character '{' when these macros are defined: 'YYENABLE_NLS'.
[ael.tab.c:3591]: (error) Invalid number of character '{' when these macros are defined: 'YYERROR_VERBOSE=0'.
[ael.tab.c:3591]: (error) Invalid number of character '{' when these macros are defined: 'YYPRINT'.
[ael.tab.c:3591]: (error) Invalid number of character '{' when these macros are defined: '_GNU_SOURCE;_STRING_H;__GLIBC__'.
[ael.tab.c:3591]: (error) Invalid number of character '{' when these macros are defined: '_MSC_VER;__C99__FUNC__;__STDC__'.
[ael.tab.c:3591]: (error) Invalid number of character '{' when these macros are defined: '_MSC_VER;__C99__FUNC__;__STDC__;lint'.
[ael.tab.c:3591]: (error) Invalid number of character '{' when these macros are defined: '_STRING_H;__GLIBC__'.
[ael.tab.c:3591]: (error) Invalid number of character '{' when these macros are defined: '__GNUC__'.
[ael.tab.c:3591]: (error) Invalid number of character '{' when these macros are defined: '__GNUC__;lint'.
[ael.tab.c:3591]: (error) Invalid number of character '{' when these macros are defined: '__STDC__'.
[ael.tab.c:3591]: (error) Invalid number of character '{' when these macros are defined: 'lint'.
[ael.tab.c:3591]: (error) Invalid number of character '{' when these macros are defined: 'short'.
[res/ael/pval.c:3632]: (error) Memory leak: for_loop
[res/ael/pval.c:3672]: (error) Memory leak: while_loop
[utils/db1-ast/recno/rec_open.c:170]: (error) Invalid number of character '(' when these macros are defined: 'MMAP_NOT_AVAILABLE'.
[utils/muted.c:764]: (error) Used file that is not opened.
```


was (Author: chipitsine):
there are several interesting findings left, I'll address them in another patch. commit and close this issue




# grep '(error' typescript | grep -v 'Uninitialized variable'
[addons/ooh323c/src/ooq931.c:507]: (error) Shifting 64-bit value by 64 bits is undefined behaviour
[channels/console_video.c:860]: (error) Invalid number of character '{' when these macros are defined: 'HAVE_FFMPEG;HAVE_VIDEO_CONSOLE'.
[ast_expr2.c:2329]: (error) Memory allocation size is negative.
[ast_expr2.c:2329]: (error) Invalid malloc() argument nr 1. The value is -1 but the valid values are '0:'.
[main/bridge_channel.c:1707]: (error) Null pointer dereference: hook
[menuselect/menuselect_curses.c:230]: (error) Undefined behavior: Variable 'buf' is used as parameter and destination in s[n]printf().
[menuselect/menuselect_gtk.c:110]: (error) Buffer is accessed out of bounds.
[ael.tab.c:3591]: (error) Invalid number of character '{' when no macros are defined.
[ael.tab.c:3591]: (error) Invalid number of character '{' when these macros are defined: 'AAL_ARGCHECK'.
[ael.tab.c:3591]: (error) Invalid number of character '{' when these macros are defined: 'ENABLE_NLS;YYENABLE_NLS'.
[ael.tab.c:3591]: (error) Invalid number of character '{' when these macros are defined: 'YYENABLE_NLS'.
[ael.tab.c:3591]: (error) Invalid number of character '{' when these macros are defined: 'YYERROR_VERBOSE=0'.
[ael.tab.c:3591]: (error) Invalid number of character '{' when these macros are defined: 'YYPRINT'.
[ael.tab.c:3591]: (error) Invalid number of character '{' when these macros are defined: '_GNU_SOURCE;_STRING_H;__GLIBC__'.
[ael.tab.c:3591]: (error) Invalid number of character '{' when these macros are defined: '_MSC_VER;__C99__FUNC__;__STDC__'.
[ael.tab.c:3591]: (error) Invalid number of character '{' when these macros are defined: '_MSC_VER;__C99__FUNC__;__STDC__;lint'.
[ael.tab.c:3591]: (error) Invalid number of character '{' when these macros are defined: '_STRING_H;__GLIBC__'.
[ael.tab.c:3591]: (error) Invalid number of character '{' when these macros are defined: '__GNUC__'.
[ael.tab.c:3591]: (error) Invalid number of character '{' when these macros are defined: '__GNUC__;lint'.
[ael.tab.c:3591]: (error) Invalid number of character '{' when these macros are defined: '__STDC__'.
[ael.tab.c:3591]: (error) Invalid number of character '{' when these macros are defined: 'lint'.
[ael.tab.c:3591]: (error) Invalid number of character '{' when these macros are defined: 'short'.
[res/ael/pval.c:3632]: (error) Memory leak: for_loop
[res/ael/pval.c:3672]: (error) Memory leak: while_loop
[utils/db1-ast/recno/rec_open.c:170]: (error) Invalid number of character '(' when these macros are defined: 'MMAP_NOT_AVAILABLE'.
[utils/muted.c:764]: (error) Used file that is not opened.


> cppcheck identifies redundant "if"
> ----------------------------------
>
>                 Key: ASTERISK-27793
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-27793
>             Project: Asterisk
>          Issue Type: Improvement
>      Security Level: None
>          Components: Addons/chan_ooh323
>    Affects Versions: 15.3.0
>            Reporter: Ilya Shipitsin
>            Assignee: Alexander Anikin
>            Severity: Trivial
>              Labels: patch, pjsip
>         Attachments: 0001-clean-cppcheck-warning.patch, ASTERISK-27793.patch
>
>
> there's already if(dfr), no need for one more



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list