Bug 8803 - Fix crash in API
authorTilghman Lesher <tilghman@meg.abyt.es>
Sun, 14 Jan 2007 05:34:32 +0000 (05:34 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Sun, 14 Jan 2007 05:34:32 +0000 (05:34 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@50784 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/config.c

index 659cfe0..2acfde8 100644 (file)
@@ -1317,18 +1317,27 @@ struct ast_config *ast_config_load_with_comments(const char *filename)
        return result;
 }
 
-struct ast_variable *ast_load_realtime_all(const char *family, ...)
+static struct ast_variable *ast_load_realtime_helper(const char *family, va_list ap)
 {
        struct ast_config_engine *eng;
        char db[256]="";
        char table[256]="";
        struct ast_variable *res=NULL;
-       va_list ap;
 
-       va_start(ap, family);
        eng = find_engine(family, db, sizeof(db), table, sizeof(table));
        if (eng && eng->realtime_func) 
                res = eng->realtime_func(db, table, ap);
+
+       return res;
+}
+
+struct ast_variable *ast_load_realtime_all(const char *family, ...)
+{
+       struct ast_variable *res;
+       va_list ap;
+
+       va_start(ap, family);
+       res = ast_load_realtime_helper(family, ap);
        va_end(ap);
 
        return res;
@@ -1340,7 +1349,7 @@ struct ast_variable *ast_load_realtime(const char *family, ...)
        va_list ap;
 
        va_start(ap, family);
-       res = ast_load_realtime_all(family, ap);
+       res = ast_load_realtime_helper(family, ap);
        va_end(ap);
 
        /* Eliminate blank entries */