[svn-commits] mmichelson: branch 1.6.0 r179971 - /branches/1.6.0/apps/app_queue.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Mar 3 15:43:41 CST 2009
Author: mmichelson
Date: Tue Mar 3 15:43:09 2009
New Revision: 179971
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=179971
Log:
Fix a memory leak when updating a realtime member field.
This was discovered while looking at issue #14353
Modified:
branches/1.6.0/apps/app_queue.c
Modified: branches/1.6.0/apps/app_queue.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.6.0/apps/app_queue.c?view=diff&rev=179971&r1=179970&r2=179971
==============================================================================
--- branches/1.6.0/apps/app_queue.c (original)
+++ branches/1.6.0/apps/app_queue.c Tue Mar 3 15:43:09 2009
@@ -1634,20 +1634,26 @@
static int update_realtime_member_field(struct member *mem, const char *queue_name, const char *field, const char *value)
{
- struct ast_variable *var;
+ struct ast_variable *var, *origvar;
int ret = -1;
- if (!(var = ast_load_realtime("queue_members", "interface", mem->interface, "queue_name", queue_name, NULL)))
+ if (!(var = ast_load_realtime("queue_members", "interface", mem->interface, "queue_name", queue_name, NULL))) {
return ret;
+ }
+
+ origvar = var;
while (var) {
- if (!strcmp(var->name, "uniqueid"))
+ if (!strcmp(var->name, "uniqueid")) {
break;
+ }
var = var->next;
}
if (var && !ast_strlen_zero(var->value)) {
- if ((ast_update_realtime("queue_members", "uniqueid", var->value, field, value, NULL)) > -1)
+ if ((ast_update_realtime("queue_members", "uniqueid", var->value, field, value, NULL)) > -1) {
ret = 0;
- }
+ }
+ }
+ ast_variables_destroy(origvar);
return ret;
}
More information about the svn-commits
mailing list