]> pilppa.com Git - uci.git/commitdiff
fix a null pointer deref in uci_file_commit when overwriting history data
authorFelix Fietkau <nbd@openwrt.org>
Fri, 4 Sep 2009 00:55:00 +0000 (02:55 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Fri, 4 Sep 2009 00:55:00 +0000 (02:55 +0200)
file.c

diff --git a/file.c b/file.c
index a58e3924048dd0c96d2bc588d1420824b4fb94a5..6b41d683b3dd903067fe5cbba51249354f726e2a 100644 (file)
--- a/file.c
+++ b/file.c
@@ -442,15 +442,11 @@ void uci_file_commit(struct uci_context *ctx, struct uci_package **package, bool
 
                        /* freed together with the uci_package */
                        path = NULL;
-
-                       /* check for updated history, flush */
-                       if (!uci_load_history(ctx, p, true))
-                               goto done;
-               } else {
-                       /* flush history */
-                       if (!uci_load_history(ctx, NULL, true))
-                               goto done;
                }
+
+               /* flush history */
+               if (!uci_load_history(ctx, p, true))
+                       goto done;
        }
 
        rewind(f);