projects
/
project
/
uci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4312495
)
fix segfault in uci batch
author
Felix Fietkau
<nbd@openwrt.org>
Sun, 31 Aug 2008 10:17:56 +0000
(12:17 +0200)
committer
Felix Fietkau
<nbd@openwrt.org>
Sun, 31 Aug 2008 10:17:56 +0000
(12:17 +0200)
util.c
patch
|
blob
|
history
diff --git
a/util.c
b/util.c
index
7f37e88
..
177bd14
100644
(file)
--- a/
util.c
+++ b/
util.c
@@
-398,14
+398,14
@@
int uci_parse_argument(struct uci_context *ctx, FILE *stream, char **str, char *
UCI_ASSERT(ctx, str != NULL);
UCI_ASSERT(ctx, result != NULL);
UCI_ASSERT(ctx, str != NULL);
UCI_ASSERT(ctx, result != NULL);
- if (ctx->pctx) {
- if (ctx->pctx->file != stream) {
- uci_cleanup(ctx);
- }
- } else {
+ if (ctx->pctx && (ctx->pctx->file != stream))
+ uci_cleanup(ctx);
+
+ if (!ctx->pctx)
uci_alloc_parse_context(ctx);
uci_alloc_parse_context(ctx);
- ctx->pctx->file = stream;
- }
+
+ ctx->pctx->file = stream;
+
if (!*str) {
uci_getln(ctx, 0);
*str = ctx->pctx->buf;
if (!*str) {
uci_getln(ctx, 0);
*str = ctx->pctx->buf;