* 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:
Alexander von Gluck IV 2011-07-26 18:27:39 +00:00
parent 40a5a5a0ac
commit 271ed0f390
2 changed files with 5 additions and 7 deletions

View File

@ -270,15 +270,15 @@ BeceemDevice::~BeceemDevice()
if (fNotifyWriteSem >= B_OK)
delete_sem(fNotifyWriteSem);
if (fNotifyBuffer)
if (fNotifyBuffer != NULL)
free(fNotifyBuffer);
// Free notification buffer
if (pwmxdevice->nvmFlashCSInfo)
if (pwmxdevice->nvmFlashCSInfo != NULL)
free(pwmxdevice->nvmFlashCSInfo);
// Free flash configuration structure
if (pwmxdevice)
if (pwmxdevice != NULL)
free(pwmxdevice);
// Free malloc of wimax device struct
@ -1017,7 +1017,7 @@ BeceemDevice::LoadConfig()
unsigned int* buffer = (unsigned int*)malloc(MAX_USB_TRANSFER);
if (!buffer) {
if (buffer == NULL) {
TRACE_ALWAYS("Error: Memory allocation error.\n");
return B_ERROR;
}
@ -1119,8 +1119,6 @@ BeceemDevice::PushConfig(unsigned int loc)
return fh;
}
size_t file_size = cfgStat.st_size;
TRACE_ALWAYS("Info: Vendor configuration to be pushed to 0x%x on device.\n",
loc);

View File

@ -501,7 +501,7 @@ BeceemNVM::FlashBulkRead(unsigned int offset, unsigned int size,
if (pwmxdevice->driverHalt == true)
return -ENODEV;
if (size > sizeof(&buffer))
if (size > sizeof(buffer))
TRACE("Warning: Reading more then the buffer can handle\n");
bSelectedChip = RESET_CHIP_SELECT;