[asterisk-commits] kmoore: branch kmoore/microfilm r397151 - /team/kmoore/microfilm/main/cel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Aug 20 12:15:54 CDT 2013


Author: kmoore
Date: Tue Aug 20 12:15:53 2013
New Revision: 397151

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=397151
Log:
Handle NULL configs properly

Modified:
    team/kmoore/microfilm/main/cel.c

Modified: team/kmoore/microfilm/main/cel.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/microfilm/main/cel.c?view=diff&rev=397151&r1=397150&r2=397151
==============================================================================
--- team/kmoore/microfilm/main/cel.c (original)
+++ team/kmoore/microfilm/main/cel.c Tue Aug 20 12:15:53 2013
@@ -1525,6 +1525,11 @@
 struct ast_cel_general_config *ast_cel_get_config(void)
 {
 	RAII_VAR(struct cel_config *, mod_cfg, ao2_global_obj_ref(cel_configs), ao2_cleanup);
+
+	if (!mod_cfg->general) {
+		return NULL;
+	}
+
 	ao2_ref(mod_cfg->general, +1);
 	return mod_cfg->general;
 }
@@ -1532,9 +1537,12 @@
 void ast_cel_set_config(struct ast_cel_general_config *config)
 {
 	RAII_VAR(struct cel_config *, mod_cfg, ao2_global_obj_ref(cel_configs), ao2_cleanup);
-	ao2_cleanup(mod_cfg->general);
+	RAII_VAR(struct ast_cel_general_config *, cleanup_config, mod_cfg->general, ao2_cleanup);
+
 	mod_cfg->general = config;
-	ao2_ref(mod_cfg->general, +1);
+	if (mod_cfg->general) {
+		ao2_ref(mod_cfg->general, +1);
+	}
 }
 
 int ast_cel_backend_unregister(const char *name)




More information about the asterisk-commits mailing list