allocations MustSucceed

This commit is contained in:
Andrew Johnson
2009-04-23 22:19:46 +00:00
parent f5f1c51b80
commit f0652aa1b6
4 changed files with 14 additions and 6 deletions

View File

@@ -25,13 +25,15 @@
static long addRec(struct dbCommon *prec)
{
prec->dpvt = calloc(1, sizeof(CALLBACK));
return 0;
return !prec->dpvt;
}
static long delRec(struct dbCommon *prec)
{
callbackCancelDelayed((CALLBACK *)prec->dpvt);
free(prec->dpvt);
if (prec->dpvt) {
callbackCancelDelayed((CALLBACK *)prec->dpvt);
free(prec->dpvt);
}
return 0;
}

View File

@@ -23,6 +23,7 @@
#include "epicsExit.h"
#include "epicsTime.h"
#include "ellLib.h"
#include "cantProceed.h"
typedef struct {
ELLNODE node;
@@ -191,7 +192,8 @@ int testDone(void) {
}
if (Harness) {
if (failed) {
testFailure *fault = calloc(1, sizeof(testFailure));
testFailure *fault = callocMustSucceed(1, sizeof(testFailure),
"testDone calloc");
fault->name = testing;
fault->tests = tested;
fault->failures = failed;

View File

@@ -36,6 +36,7 @@
#include "errMdef.h"
#include "recSup.h"
#include "recGbl.h"
#include "cantProceed.h"
#define GEN_SIZE_OFFSET
#include "subArrayRecord.h"
#undef GEN_SIZE_OFFSET
@@ -105,7 +106,8 @@ static long init_record(subArrayRecord *prec, int pass)
prec->malm = 1;
if (prec->ftvl > DBF_ENUM)
prec->ftvl = DBF_UCHAR;
prec->bptr = calloc(prec->malm, dbValueSize(prec->ftvl));
prec->bptr = callocMustSucceed(prec->malm, dbValueSize(prec->ftvl),
"subArrayRecord calloc failed");
prec->nord = 0;
return 0;
}

View File

@@ -32,6 +32,7 @@
#include "errMdef.h"
#include "recSup.h"
#include "recGbl.h"
#include "cantProceed.h"
#define GEN_SIZE_OFFSET
#include "waveformRecord.h"
#undef GEN_SIZE_OFFSET
@@ -97,7 +98,8 @@ static long init_record(waveformRecord *prec, int pass)
prec->nelm = 1;
if (prec->ftvl > DBF_ENUM)
prec->ftvl = DBF_UCHAR;
prec->bptr = calloc(prec->nelm, dbValueSize(prec->ftvl));
prec->bptr = callocMustSucceed(prec->nelm, dbValueSize(prec->ftvl),
"waveform calloc failed");
if (prec->nelm == 1) {
prec->nord = 1;
} else {