From: Arran Cudbard-Bell Date: Fri, 17 Nov 2017 23:31:47 +0000 (+0000) Subject: Memory allocation check X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bbd809ddea787e96abb57ce70ef7461696f4275e;p=thirdparty%2Ffreeradius-server.git Memory allocation check --- diff --git a/src/main/radsnmp.c b/src/main/radsnmp.c index b8f015dfd7b..99064e00195 100644 --- a/src/main/radsnmp.c +++ b/src/main/radsnmp.c @@ -113,7 +113,7 @@ static void NEVER_RETURNS usage(void) fprintf(stderr, " -P Use proto (tcp or udp) for transport.\n"); #endif - exit(1); + exit(EXIT_FAILURE); } #define RESPOND_STATIC(_cmd) \ @@ -250,8 +250,7 @@ static ssize_t radsnmp_pair_from_oid(TALLOC_CTX *ctx, radsnmp_conf_t *conf, vp_c * We've skipped over the index attribute, and * the index number should be available in attr. */ - vp = fr_pair_afrom_da(ctx, index_attr); - if (!vp) _exit(1); + MEM(vp = fr_pair_afrom_da(ctx, index_attr)); vp->vp_uint32 = attr; fr_pair_cursor_append(cursor, vp); @@ -1066,7 +1065,7 @@ int main(int argc, char **argv) */ if (fr_inet_pton_port(&conf->server_ipaddr, &conf->server_port, argv[1], -1, force_af, true, true) < 0) { ERROR("%s", fr_strerror()); - exit(1); + exit(EXIT_FAILURE); } /* @@ -1085,7 +1084,7 @@ int main(int argc, char **argv) ERROR("Incomplete dictionary: Missing definition for Extended-Attribute-1"); dict_error: talloc_free(conf); - exit(1); + exit(EXIT_FAILURE); } parent = fr_dict_attr_child_by_num(parent, FR_VENDOR_SPECIFIC); if (!parent) {