* Fix improper sizeof, CID 10628
* Improve malloc check to look for NULL, CID 10698 * Remove unused size_t git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42499 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -270,15 +270,15 @@ BeceemDevice::~BeceemDevice()
|
|||||||
if (fNotifyWriteSem >= B_OK)
|
if (fNotifyWriteSem >= B_OK)
|
||||||
delete_sem(fNotifyWriteSem);
|
delete_sem(fNotifyWriteSem);
|
||||||
|
|
||||||
if (fNotifyBuffer)
|
if (fNotifyBuffer != NULL)
|
||||||
free(fNotifyBuffer);
|
free(fNotifyBuffer);
|
||||||
// Free notification buffer
|
// Free notification buffer
|
||||||
|
|
||||||
if (pwmxdevice->nvmFlashCSInfo)
|
if (pwmxdevice->nvmFlashCSInfo != NULL)
|
||||||
free(pwmxdevice->nvmFlashCSInfo);
|
free(pwmxdevice->nvmFlashCSInfo);
|
||||||
// Free flash configuration structure
|
// Free flash configuration structure
|
||||||
|
|
||||||
if (pwmxdevice)
|
if (pwmxdevice != NULL)
|
||||||
free(pwmxdevice);
|
free(pwmxdevice);
|
||||||
// Free malloc of wimax device struct
|
// Free malloc of wimax device struct
|
||||||
|
|
||||||
@@ -1017,7 +1017,7 @@ BeceemDevice::LoadConfig()
|
|||||||
|
|
||||||
unsigned int* buffer = (unsigned int*)malloc(MAX_USB_TRANSFER);
|
unsigned int* buffer = (unsigned int*)malloc(MAX_USB_TRANSFER);
|
||||||
|
|
||||||
if (!buffer) {
|
if (buffer == NULL) {
|
||||||
TRACE_ALWAYS("Error: Memory allocation error.\n");
|
TRACE_ALWAYS("Error: Memory allocation error.\n");
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
@@ -1119,8 +1119,6 @@ BeceemDevice::PushConfig(unsigned int loc)
|
|||||||
return fh;
|
return fh;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t file_size = cfgStat.st_size;
|
|
||||||
|
|
||||||
TRACE_ALWAYS("Info: Vendor configuration to be pushed to 0x%x on device.\n",
|
TRACE_ALWAYS("Info: Vendor configuration to be pushed to 0x%x on device.\n",
|
||||||
loc);
|
loc);
|
||||||
|
|
||||||
|
|||||||
@@ -501,7 +501,7 @@ BeceemNVM::FlashBulkRead(unsigned int offset, unsigned int size,
|
|||||||
if (pwmxdevice->driverHalt == true)
|
if (pwmxdevice->driverHalt == true)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
if (size > sizeof(&buffer))
|
if (size > sizeof(buffer))
|
||||||
TRACE("Warning: Reading more then the buffer can handle\n");
|
TRACE("Warning: Reading more then the buffer can handle\n");
|
||||||
|
|
||||||
bSelectedChip = RESET_CHIP_SELECT;
|
bSelectedChip = RESET_CHIP_SELECT;
|
||||||
|
|||||||
Reference in New Issue
Block a user