[asterisk-commits] bbryant: trunk r131717 - /trunk/main/features.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 17 13:14:42 CDT 2008


Author: bbryant
Date: Thu Jul 17 13:14:42 2008
New Revision: 131717

URL: http://svn.digium.com/view/asterisk?view=rev&rev=131717
Log:
Fix a memory leak in register_group_feature when attempting to register 
a feature without specifying a group or feature to register.

(closes issue #13101)
Reported by: eliel
Patches:
      features.c.patch uploaded by eliel (license 64)

Modified:
    trunk/main/features.c

Modified: trunk/main/features.c
URL: http://svn.digium.com/view/asterisk/trunk/main/features.c?view=diff&rev=131717&r1=131716&r2=131717
==============================================================================
--- trunk/main/features.c (original)
+++ trunk/main/features.c Thu Jul 17 13:14:42 2008
@@ -1498,6 +1498,16 @@
 {
 	struct feature_group_exten *fge;
 
+	if (!fg) {
+		ast_log(LOG_NOTICE, "You didn't pass a group!\n");
+		return;
+	}
+
+	if (!feature) {
+		ast_log(LOG_NOTICE, "You didn't pass a feature!\n");
+		return;
+	}
+
 	if (!(fge = ast_calloc(1, sizeof(*fge))))
 		return;
 
@@ -1506,17 +1516,7 @@
 		return;
 	}
 
-	if (!fg) {
-		ast_log(LOG_NOTICE, "You didn't pass a group!\n");
-		return;
-	}
-
-	if (!feature) {
-		ast_log(LOG_NOTICE, "You didn't pass a feature!\n");
-		return;
-	}
-
-	ast_string_field_set(fge, exten, (ast_strlen_zero(exten) ? feature->exten : exten));
+	ast_string_field_set(fge, exten, S_OR(exten, feature->exten));
 
 	fge->feature = feature;
 




More information about the asterisk-commits mailing list