Code Maintenance - nullptr checking
This commit is contained in:
parent
0555d70a37
commit
0019b22046
10 changed files with 29 additions and 3 deletions
|
@ -344,6 +344,8 @@ void Flite_Text_Analyzer_analysis(Flite_Text_Analyzer * analyzer, const char *te
|
|||
|
||||
/* allocate */
|
||||
fu = (Flite_Utterance *) malloc(sizeof(Flite_Utterance));
|
||||
if (fu == NULL)
|
||||
return;
|
||||
|
||||
/* create voice */
|
||||
fu->v = REGISTER_VOX(NULL);
|
||||
|
|
3
3rdparty/hidapi/hidparser/hidparse.c
vendored
3
3rdparty/hidapi/hidparser/hidparse.c
vendored
|
@ -99,6 +99,9 @@ uint32_t pop_local_item(uint8_t tag);
|
|||
hid_item* build_item(uint8_t tag, uint8_t flags, hid_item* global_state)
|
||||
{
|
||||
hid_item* item = (hid_item*) calloc(sizeof(hid_item), 1);
|
||||
if (item == NULL)
|
||||
return NULL;
|
||||
|
||||
item->flags = flags;
|
||||
item->usage = pop_local_item(HID_USAGE_ITEM);
|
||||
item->type = tag;
|
||||
|
|
3
3rdparty/hidapi/linux/hid.c
vendored
3
3rdparty/hidapi/linux/hid.c
vendored
|
@ -104,6 +104,9 @@ static __u32 detect_kernel_version(void)
|
|||
static hid_device *new_hid_device(void)
|
||||
{
|
||||
hid_device *dev = calloc(1, sizeof(hid_device));
|
||||
if (dev == NULL)
|
||||
return NULL;
|
||||
|
||||
dev->device_handle = -1;
|
||||
dev->blocking = 1;
|
||||
dev->uses_numbered_reports = 0;
|
||||
|
|
6
3rdparty/hidapi/mac/hid.c
vendored
6
3rdparty/hidapi/mac/hid.c
vendored
|
@ -125,6 +125,9 @@ struct hid_device_ {
|
|||
static hid_device *new_hid_device(void)
|
||||
{
|
||||
hid_device *dev = calloc(1, sizeof(hid_device));
|
||||
if (dev == NULL)
|
||||
return NULL;
|
||||
|
||||
dev->device_handle = NULL;
|
||||
dev->blocking = 1;
|
||||
dev->uses_numbered_reports = 0;
|
||||
|
@ -562,6 +565,9 @@ static void hid_report_callback(void *context, IOReturn result, void *sender,
|
|||
|
||||
/* Make a new Input Report object */
|
||||
rpt = calloc(1, sizeof(struct input_report));
|
||||
if (rpt == NULL)
|
||||
return;
|
||||
|
||||
rpt->data = calloc(1, report_length);
|
||||
memcpy(rpt->data, report, report_length);
|
||||
rpt->len = report_length;
|
||||
|
|
|
@ -120,7 +120,10 @@ PxMixer *Px_OpenMixer( void *pa_stream, int index )
|
|||
Handle h;
|
||||
unsigned char *data;
|
||||
|
||||
info = (PxInfo *)malloc(sizeof(PxInfo));
|
||||
info = (PxInfo *)malloc(sizeof(PxInfo));
|
||||
if (info == NULL)
|
||||
return NULL;
|
||||
|
||||
past = (internalPortAudioStream *) pa_stream;
|
||||
macInfo = (PaHostSoundControl *) past->past_DeviceData;
|
||||
|
||||
|
|
|
@ -121,6 +121,9 @@ PxMixer *Px_OpenMixer( void *pa_stream, int index )
|
|||
return NULL;
|
||||
|
||||
info = (PxInfo *)malloc(sizeof(PxInfo));
|
||||
if (info == NULL)
|
||||
return NULL;
|
||||
|
||||
info->index = PxDevice[index];
|
||||
|
||||
if (PxDevices[index]==0)
|
||||
|
|
|
@ -137,6 +137,9 @@ PxMixer *Px_OpenMixer( void *pa_stream, int index )
|
|||
return NULL;
|
||||
|
||||
mixer = (PxInfo *)malloc(sizeof(PxInfo));
|
||||
if (mixer == NULL)
|
||||
return NULL;
|
||||
|
||||
mixer->hInputMixer = NULL;
|
||||
mixer->hOutputMixer = NULL;
|
||||
|
||||
|
|
2
3rdparty/iaxclient/lib/unixfuncs.c
vendored
2
3rdparty/iaxclient/lib/unixfuncs.c
vendored
|
@ -369,6 +369,8 @@ int iaxci_prioboostbegin()
|
|||
{
|
||||
struct sched_param schp = { 0 };
|
||||
prioboost *b = calloc(sizeof(*b),1);
|
||||
if (b == NULL)
|
||||
return 1;
|
||||
|
||||
int result = 0;
|
||||
|
||||
|
|
3
3rdparty/iaxclient/lib/video.c
vendored
3
3rdparty/iaxclient/lib/video.c
vendored
|
@ -1285,7 +1285,8 @@ int video_recv_video(struct iaxc_call *call, int sel_call,
|
|||
if ( !call->vdecoder )
|
||||
{
|
||||
call->vdecoder = create_codec(format, 0);
|
||||
fprintf(stderr,"**** Created decoder codec %s\n",call->vdecoder->name);
|
||||
if (call->vdecoder != NULL)
|
||||
fprintf(stderr,"**** Created decoder codec %s\n",call->vdecoder->name);
|
||||
}
|
||||
|
||||
if ( !call->vdecoder )
|
||||
|
|
|
@ -433,7 +433,7 @@ bool geodFromHash(naRef ref, SGGeod& result)
|
|||
|
||||
int geodFromArgs(naRef* args, int offset, int argc, SGGeod& result)
|
||||
{
|
||||
if (offset >= argc) {
|
||||
if (offset >= argc || !args) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue