Skip to content
Snippets Groups Projects
Commit 4899dda4 authored by lemoer's avatar lemoer Committed by Matthias Schiffer
Browse files

treewide: check for NULL after uci_alloc_context() (#1224)

parent c0b4fb54
No related branches found
No related tags found
No related merge requests found
......@@ -36,6 +36,8 @@
static struct json_object * get_autoupdater(void) {
struct uci_context *ctx = uci_alloc_context();
if (!ctx)
return NULL;
ctx->flags &= ~UCI_FLAG_STRICT;
struct uci_package *p;
......
......@@ -446,6 +446,8 @@ static void count_iface_stations(size_t *wifi24, size_t *wifi5, const char *ifna
static void count_stations(size_t *wifi24, size_t *wifi5) {
struct uci_context *ctx = uci_alloc_context();
if (!ctx)
return;
ctx->flags &= ~UCI_FLAG_STRICT;
......
......@@ -77,6 +77,8 @@ static struct json_object * get_fastd(void) {
bool enabled = false;
struct uci_context *ctx = uci_alloc_context();
if (!ctx)
goto disabled_nofree;
ctx->flags &= ~UCI_FLAG_STRICT;
struct uci_package *p;
......@@ -92,8 +94,8 @@ static struct json_object * get_fastd(void) {
enabled = true;
disabled:
uci_free_context(ctx);
disabled_nofree:
struct json_object *ret = json_object_new_object();
json_object_object_add(ret, "version", get_fastd_version());
......@@ -159,6 +161,8 @@ static struct json_object * get_status(void) {
struct json_object *ret = NULL;
struct uci_context *ctx = uci_alloc_context();
if (!ctx)
return NULL;
ctx->flags &= ~UCI_FLAG_STRICT;
struct uci_package *p;
......
......@@ -117,6 +117,8 @@ static struct json_object * respondd_provider_nodeinfo(void) {
struct json_object *ret = json_object_new_object();
struct uci_context *ctx = uci_alloc_context();
if (!ctx)
return ret;
ctx->flags &= ~UCI_FLAG_STRICT;
struct uci_package *p;
......
......@@ -70,6 +70,8 @@ static struct json_object * get_hostname(void) {
struct json_object *ret = NULL;
struct uci_context *ctx = uci_alloc_context();
if (!ctx)
return NULL;
ctx->flags &= ~UCI_FLAG_STRICT;
char section[] = "system.@system[0]";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment