X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fuci.git;a=blobdiff_plain;f=history.c;h=789cd875429d72c61f9573188e080137b383f426;hp=1fe2900821a8d8a10715ff73eced4357a6d066ce;hb=5f169aebd1d827bd19bc22b881c11994a8adb3f4;hpb=718a82c0daf03070304ac94edd57e1a726300a95 diff --git a/history.c b/history.c index 1fe2900..789cd87 100644 --- a/history.c +++ b/history.c @@ -332,7 +332,7 @@ int uci_revert(struct uci_context *ctx, struct uci_ptr *ptr) char *option = NULL; UCI_HANDLE_ERR(ctx); - expand_ptr(ctx, ptr, true); + expand_ptr(ctx, ptr, false); UCI_ASSERT(ctx, ptr->p->has_history); /* @@ -348,8 +348,10 @@ int uci_revert(struct uci_context *ctx, struct uci_ptr *ptr) /* NB: need to clone package, section and option names, * as they may get freed on uci_free_package() */ package = uci_strdup(ctx, ptr->p->e.name); - section = uci_strdup(ctx, ptr->section); - option = uci_strdup(ctx, ptr->option); + if (ptr->section) + section = uci_strdup(ctx, ptr->section); + if (ptr->option) + option = uci_strdup(ctx, ptr->option); uci_free_package(&ptr->p); uci_filter_history(ctx, package, section, option);