autoupdater: Check if allocation of uci contect was successfull

Previously the return value of uci_alloc_context was not checked leading
to a possible null ptr dereference

Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
This commit is contained in:
Tobias Schramm 2018-02-20 12:15:42 +01:00
parent a96a2d7718
commit a6336d0bce
1 changed files with 5 additions and 0 deletions

View File

@ -110,6 +110,11 @@ static const char ** load_string_list(struct uci_context *ctx, struct uci_sectio
void load_settings(struct settings *settings) {
struct uci_context *ctx = uci_alloc_context();
if (!ctx) {
fprintf(stderr, "autoupdater: error: failed to allocate uci context\n");
exit(1);
}
ctx->flags &= ~UCI_FLAG_STRICT;
struct uci_package *p;