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 a58e392..6b41d68 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);