[asterisk-commits] mjordan: branch 11 r434090 - /branches/11/pbx/pbx_config.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Apr 6 13:03:25 CDT 2015
Author: mjordan
Date: Mon Apr 6 13:03:23 2015
New Revision: 434090
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=434090
Log:
clang compiler warnings: Fix sometimes-uninitialized warning in pbx_config
This patch fixes a warning caught by clang, in which a char pointer could be
assigned to before it was initialized. The patch re-organizes the code to
ensure that the pointer is always initialized, even on off nominal paths.
Review: https://reviewboard.asterisk.org/r/4529
ASTERISK-24917
Reported by: dkdegroot
patches:
rb4529.patch submitted by dkdegroot (License 6600)
Modified:
branches/11/pbx/pbx_config.c
Modified: branches/11/pbx/pbx_config.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/pbx/pbx_config.c?view=diff&rev=434090&r1=434089&r2=434090
==============================================================================
--- branches/11/pbx/pbx_config.c (original)
+++ branches/11/pbx/pbx_config.c Mon Apr 6 13:03:23 2015
@@ -855,7 +855,9 @@
const char *el = ast_get_extension_label(p);
char label[128] = "";
char *appdata = ast_get_extension_app_data(p);
- char *escaped;
+
+ int escaped_len = (!ast_strlen_zero(appdata)) ? 2 * strlen(appdata) + 1 : 1;
+ char escaped[escaped_len];
if (ast_get_extension_matchcid(p)) {
sep = "/";
@@ -869,12 +871,9 @@
}
if (!ast_strlen_zero(appdata)) {
- int escaped_len = 2 * strlen(appdata) + 1;
- char escaped[escaped_len];
-
ast_escape_semicolons(appdata, escaped, escaped_len);
} else {
- escaped = "";
+ escaped[0] = '\0';
}
fprintf(output, "exten => %s%s%s,%d%s,%s(%s)\n",
More information about the asterisk-commits
mailing list