aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_realtime.c
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-12-17 20:51:38 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-12-17 20:51:38 +0000
commitf3428dead2d1fd1b9cd475c3f10d97e5015c87dc (patch)
treeb30293e93473d2e15972bbcdc8a76f23ac82d45e /apps/app_realtime.c
parentf23ceae472166f900873b9033b9dae684cba25c4 (diff)
Fix some memory leaks found while looking at how realtime
configs are handled. Also cleaned up some coding guidelines violations in app_realtime.c, mostly related to spacing git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@165255 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_realtime.c')
-rw-r--r--apps/app_realtime.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/apps/app_realtime.c b/apps/app_realtime.c
index 48e1dca5b..9bc6e315b 100644
--- a/apps/app_realtime.c
+++ b/apps/app_realtime.c
@@ -72,22 +72,24 @@ static char *udesc = "Use the RealTime config handler system to update a value\n
static int cli_realtime_load(int fd, int argc, char **argv)
{
char *header_format = "%30s %-30s\n";
- struct ast_variable *var=NULL;
+ struct ast_variable *var = NULL, *save = NULL;
- if(argc<5) {
+ if (argc < 5) {
ast_cli(fd, "You must supply a family name, a column to match on, and a value to match to.\n");
return RESULT_FAILURE;
}
var = ast_load_realtime(argv[2], argv[3], argv[4], NULL);
- if(var) {
+ if (var) {
+ save = var;
ast_cli(fd, header_format, "Column Name", "Column Value");
ast_cli(fd, header_format, "--------------------", "--------------------");
- while(var) {
+ while (var) {
ast_cli(fd, header_format, var->name, var->value);
var = var->next;
}
+ ast_variables_destroy(save);
} else {
ast_cli(fd, "No rows found matching search criteria.\n");
}