#include "file_op.h"
+#include "Osal.h"
#include <errno.h>
#include <stdlib.h>
#include <string.h>
}
/* allocating data buffer with enough size */
- *buffer = new uint8_t[size];
+ *buffer = (unsigned char *)OsaMalloc(size);
if (!(*buffer)) {
SLOGD("[%s][%d] Can't malloc pBuffer to 'fread'. ", __FUNCTION__, __LINE__);
fclose(file);
#include <ctype.h>
#include "ss_misc.h"
#include "OsaLinuxUser.h"
+#include <new>
#ifdef _SECOS_SIM_
#include "file_op.h"
return SS_RET_INTERNAL_ERROR;
}
- pBuffer = new CBT_OCTET[uKeyMaterialSize + 16];
+ pBuffer = new(std::nothrow) CBT_OCTET[uKeyMaterialSize + 16];
if (!pBuffer) {
SLOGE("Alloc memory failed.\n");
return SS_RET_MALLOC_FAILED;
__FUNCTION__,
__LINE__,
FileStructureType(m_file_content.m_pFileHeader));
- delete data;
+ OsaFree(data);
return SS_RET_FAIL;
}
break;
int secure_file::write_temp_store(unsigned char* data, unsigned int size) {
if (-1 == m_cache->write(m_full_path, data, size)) {
SLOGI("[%s][%d] Writing to cache storage failed.", __FUNCTION__, __LINE__);
- delete data;
+ OsaFree(data);
return SS_RET_FAIL;
}
- delete data;
+ OsaFree(data);
return SS_RET_SUCCESS;
}
#include "ss_temp_store.h"
#include "slog.h"
+#include <new>
#define SS_NODE_ID_CMP(id1, id2) memcmp(static_cast<void*>(id1),static_cast<void*>(id2),SS_NODE_ID_LEN)
#define SS_NODE_ID_CPY(dest,src) memcpy(static_cast<void*>(dest),static_cast<void*>(src),SS_NODE_ID_LEN)
return SS_RET_SUCCESS;
}
- node = new temp_ss_node;
+ node = new(std::nothrow) temp_ss_node;
if (NULL == node) {
SLOGE("Failed to malloc memory.");
return SS_RET_MALLOC_FAILED;
node->data = (unsigned char*)OsaMalloc(data_size);
if (NULL == node->data) {
SLOGE("Failed to malloc data.");
- OsaFree(node);
+ delete node;
return SS_RET_MALLOC_FAILED;
}