diff options
author | Felix Fietkau <nbd@openwrt.org> | 2011-10-21 15:12:04 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2011-10-21 15:17:06 +0200 |
commit | ef95525edc1ade7e729187b011de889b8f5f57c6 (patch) | |
tree | b43b88ba7bafa276ec0b554dd80ebd31ff832019 /file.c | |
parent | 2b86a11e49aa14d24c1e85ff5a7bd5ce58565df6 (diff) | |
download | uci-ef95525edc1ade7e729187b011de889b8f5f57c6.tar.gz |
check result of memory allocations (patch by Stanislav Fomichev)
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -508,7 +508,7 @@ invalid: /* * escape an uci string for export */ -static char *uci_escape(struct uci_context *ctx, const char *str) +static const char *uci_escape(struct uci_context *ctx, const char *str) { const char *end; int ofs = 0; @@ -516,6 +516,9 @@ static char *uci_escape(struct uci_context *ctx, const char *str) if (!ctx->buf) { ctx->bufsz = LINEBUF; ctx->buf = malloc(LINEBUF); + + if (!ctx->buf) + return str; } while (1) { |