From: Alan T. DeKok Date: Wed, 6 Nov 2019 22:20:37 +0000 (-0500) Subject: check for OOM errors X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22c01fc791a9ae6c61e4705d47fac5d548600d04;p=thirdparty%2Ffreeradius-server.git check for OOM errors --- diff --git a/src/lib/util/dict_tokenize.c b/src/lib/util/dict_tokenize.c index e226e67b687..1ab3a186c2f 100644 --- a/src/lib/util/dict_tokenize.c +++ b/src/lib/util/dict_tokenize.c @@ -1256,7 +1256,10 @@ static int dict_read_process_protocol(char **argv, int argc) /* * Set the root attribute with the protocol name */ - dict_root_set(dict, argv[0], value); + if (dict_root_set(dict, argv[0], value) < 0) { + talloc_free(dict); + return -1; + } if (dict_protocol_add(dict) < 0) return -1; @@ -2257,7 +2260,7 @@ int fr_dict_internal_afrom_file(fr_dict_t **out, char const *dict_subdir) /* * Set the root name of the dictionary */ - dict_root_set(dict, "internal", 0); + if (dict_root_set(dict, "internal", 0) < 0) goto error; /* * Add cast attributes. We do it this way, diff --git a/src/lib/util/dict_util.c b/src/lib/util/dict_util.c index 59b9b64f4c1..4885910e33a 100644 --- a/src/lib/util/dict_util.c +++ b/src/lib/util/dict_util.c @@ -386,6 +386,8 @@ fr_dict_attr_t *dict_attr_alloc_name(TALLOC_CTX *ctx, char const *name) } da = talloc_zero(ctx, fr_dict_attr_t); + if (!da) return NULL; + da->name = talloc_typed_strdup(da, name); if (!da->name) { talloc_free(da);