Check for allocation failure
authorAlan T. DeKok <aland@freeradius.org>
Thu, 4 Feb 2010 07:59:53 +0000 (08:59 +0100)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 4 Feb 2010 08:02:55 +0000 (09:02 +0100)
src/main/util.c

index 34d2094..6cd01b3 100644 (file)
@@ -497,9 +497,15 @@ REQUEST *request_alloc_coa(REQUEST *request)
            (request->packet->code != PW_ACCOUNTING_REQUEST)) return NULL;
 
        request->coa = request_alloc_fake(request);
+       if (!request->coa) return NULL;
+
        request->coa->packet->code = 0; /* unknown, as of yet */
        request->coa->child_state = REQUEST_RUNNING;
        request->coa->proxy = rad_alloc(0);
+       if (!request->coa->proxy) {
+               request_free(&request->coa);
+               return NULL;
+       }
 
        return request->coa;
 }