changeset 6200:9d77a7d26f28 HEAD

Crashfix
author Timo Sirainen <tss@iki.fi>
date Tue, 07 Aug 2007 01:24:59 +0300
parents c1d09af8bdda
children 4a8a19fea50d
files src/plugins/quota/quota.c
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/quota/quota.c	Tue Aug 07 01:00:12 2007 +0300
+++ b/src/plugins/quota/quota.c	Tue Aug 07 01:24:59 2007 +0300
@@ -56,12 +56,13 @@
 void quota_deinit(struct quota **_quota)
 {
 	struct quota *quota = *_quota;
-	struct quota_root **root;
+	struct quota_root **root_p, *root;
 
 	*_quota = NULL;
 	while (array_count(&quota->roots) > 0) {
-		root = array_idx_modifiable(&quota->roots, 0);
-		quota_root_deinit(root);
+		root_p = array_idx_modifiable(&quota->roots, 0);
+		root = *root_p;
+		quota_root_deinit(&root);
 	}
 
 	array_free(&quota->roots);
@@ -148,12 +149,15 @@
 	struct quota_warning_rule *warnings;
 	unsigned int i, count;
 
+	*_root = NULL;
+
 	roots = array_get(&root->quota->roots, &count);
 	for (i = 0; i < count; i++) {
-		if (roots[i] == root)
+		if (roots[i] == root) {
 			array_delete(&root->quota->roots, i, 1);
+			break;
+		}
 	}
-	*_root = NULL;
 
 	warnings = array_get_modifiable(&root->warning_rules, &count);
 	for (i = 0; i < count; i++)