summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common/db.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/common/db.c b/src/common/db.c
index 74c3b1f91..481e9db2a 100644
--- a/src/common/db.c
+++ b/src/common/db.c
@@ -2601,15 +2601,14 @@ void linkdb_insert( struct linkdb_node** head, void *key, void* data)
void linkdb_foreach( struct linkdb_node** head, LinkDBFunc func, ... )
{
- va_list args;
struct linkdb_node *node;
-
if( head == NULL ) return;
-
- va_start(args, func);
node = *head;
while ( node ) {
+ va_list args;
+ va_start(args, func);
func( node->key, node->data, args );
+ va_end(args);
node = node->next;
}
}