[Asterisk-code-review] Fix unsafe uses of ast context pointers. (asterisk[11])

Richard Mudgett asteriskteam at digium.com
Wed Jun 3 13:44:56 CDT 2015


Richard Mudgett has posted comments on this change.

Change subject: Fix unsafe uses of ast_context pointers.
......................................................................


Patch Set 2:

(2 comments)

https://gerrit.asterisk.org/#/c/481/2/include/asterisk/pbx.h
File include/asterisk/pbx.h:

Line 307:  * \brief Destroy a context (matches the specified context (or ANY context if NULL)
I suppose you could have kept the fix for the mismatched parentheses here. :)


https://gerrit.asterisk.org/#/c/481/2/pbx/pbx_config.c
File pbx/pbx_config.c:

Line 100: 	ast_wrlock_contexts();
        : 	con = ast_context_find(a->argv[3]);
        : 
        : 	if (!con) {
        : 		ast_unlock_contexts();
        : 		ast_cli(a->fd, "There is no such context as '%s'\n", a->argv[3]);
        : 		return CLI_SUCCESS;
        : 	} else {
        : 		ast_context_destroy(con, registrar);
        : 		ast_unlock_contexts();
        : 		ast_cli(a->fd, "Removing context '%s'\n",
        : 			a->argv[3]);
        : 		return CLI_SUCCESS;
        : 	}
        : }
You could make ast_context_destroy_by_name() return nonzero if it found the context to destroy.  Then you won't need to inline the function here.


-- 
To view, visit https://gerrit.asterisk.org/481
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I1866b6787730c9c4f3f836b6133ffe9c820734fa
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: 11
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-HasComments: Yes



More information about the asterisk-code-review mailing list