From: Jonathan Rose Date: Thu, 10 May 2012 15:35:33 +0000 (+0000) Subject: Coverity Report: Fix issues for error type UNINIT in Core supported modules X-Git-Tag: 1.8.14.0-rc1~3^2~43 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a7650f8002fe9052e7395fa1383cfb6f5e23159a;p=thirdparty%2Fasterisk.git Coverity Report: Fix issues for error type UNINIT in Core supported modules (issue ASTERISK-19652) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/1909/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@366048 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c index c8f08af3ce..21674a533e 100644 --- a/apps/app_chanspy.c +++ b/apps/app_chanspy.c @@ -1250,6 +1250,7 @@ static int extenspy_exec(struct ast_channel *chan, const char *data) } } else { + /* Coverity - This uninit_use should be ignored since this macro initializes the flags */ ast_clear_flag(&flags, AST_FLAGS_ALL); } @@ -1294,6 +1295,7 @@ static int dahdiscan_exec(struct ast_channel *chan, const char *data) int res; char *mygroup = NULL; + /* Coverity - This uninit_use should be ignored since this macro initializes the flags */ ast_clear_flag(&flags, AST_FLAGS_ALL); if (!ast_strlen_zero(data)) { diff --git a/apps/app_disa.c b/apps/app_disa.c index 3ca0800096..c3aa8976c2 100644 --- a/apps/app_disa.c +++ b/apps/app_disa.c @@ -181,8 +181,13 @@ static int disa_exec(struct ast_channel *chan, const char *data) args.context = "disa"; if (ast_strlen_zero(args.mailbox)) args.mailbox = ""; - if (!ast_strlen_zero(args.options)) + if (!ast_strlen_zero(args.options)) { ast_app_parse_options(app_opts, &flags, NULL, args.options); + } else { + /* Coverity - This uninit_use should be ignored since this macro initializes the flags */ + ast_clear_flag(&flags, AST_FLAGS_ALL); + } + ast_debug(1, "Mailbox: %s\n",args.mailbox); diff --git a/apps/app_page.c b/apps/app_page.c index 40b102da71..9908bcbcd2 100644 --- a/apps/app_page.c +++ b/apps/app_page.c @@ -177,6 +177,11 @@ static int page_exec(struct ast_channel *chan, const char *data) if (!ast_strlen_zero(args.options)) { ast_app_parse_options(page_opts, &flags, opts, args.options); + } else { + /* opts must be initialized if there wasn't an options string. */ + for (i = 0; i < OPT_ARG_ARRAY_SIZE; i++) { + opts[i] = NULL; + } } if (!ast_strlen_zero(args.timeout)) { diff --git a/funcs/func_cdr.c b/funcs/func_cdr.c index 25e10a2fa4..0e025c0584 100644 --- a/funcs/func_cdr.c +++ b/funcs/func_cdr.c @@ -197,7 +197,7 @@ AST_APP_OPTIONS(cdr_func_options, { static int cdr_read(struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len) { - char *ret; + char *ret = NULL; struct ast_flags flags = { 0 }; struct ast_cdr *cdr; AST_DECLARE_APP_ARGS(args, diff --git a/main/features.c b/main/features.c index 81c6cd5f4e..2b97d7bcfc 100644 --- a/main/features.c +++ b/main/features.c @@ -3345,9 +3345,11 @@ static int feature_interpret(struct ast_channel *chan, struct ast_channel *peer, struct ast_flags features; struct ast_call_feature feature; if (sense == FEATURE_SENSE_CHAN) { + /* Coverity - This uninit_use should be ignored since this macro initializes the flags */ ast_copy_flags(&features, &(config->features_caller), AST_FLAGS_ALL); } else { + /* Coverity - This uninit_use should be ignored since this macro initializes the flags */ ast_copy_flags(&features, &(config->features_callee), AST_FLAGS_ALL); }