[Asterisk-Dev] res_config_mysql.c v1.7

Matthew Boehm mboehm at cytelcom.com
Fri Jan 28 10:08:15 MST 2005


I received an email about a seg fault with res_config_mysql 1.5.1 yesterday
when using the driver with RealTime Extensions. I got the same segfault on
my machine and I sent the guy a patch but he hasn't responded. I'd rather
not post the patch to mantis until i hear back from him, but if it does fix
the problem then I want to get it out fast.

if anyone out there is using res_config_mysql.c v1.5.1 could apply the patch
below and let me know. (if you can force the segfault first before patching
then run the same steps post-patch to verify that it does indeed fix the
problem, that would awesome). the patch works for me.


thanks,
matthew


Index: res_config_mysql.c
===================================================================
RCS file: /usr/cvsroot/asterisk-addons/res_config_mysql.c,v
retrieving revision 1.6
diff -u -r1.6 res_config_mysql.c
--- res_config_mysql.c  27 Jan 2005 02:55:26 -0000      1.6
+++ res_config_mysql.c  28 Jan 2005 17:05:16 -0000
@@ -8,6 +8,11 @@
  *
  * res_config_mysql.c <mysql plugin for RealTime configuration engine >
  *
+ * v1.7   - (01-28-05) - Fixed non-initialization of ast_category struct
+ *                       in realtime_multi_mysql function which caused
segfault.
+ *
+ * v1.6   - (00-00-00) - Skipped to bring comments into sync with version
number in CVS.
+ *
  * v1.5.1 - (01-26-05) - Added better(?) locking stuff
  *
  * v1.5   - (01-26-05) - Brought up to date with new config.h changes (bug
#3406)
@@ -242,6 +247,11 @@

                while((row = mysql_fetch_row(result))) {
                        var = NULL;
+                       cat = ast_category_new("");
+                       if(!cat) {
+                               ast_log(LOG_WARNING, "Out of memory!\n");
+                               continue;
+                       }
                        for(i = 0; i < numFields; i++) {
                                stringp = row[i];
                                while(stringp) {




More information about the asterisk-dev mailing list