pFolderList->msg_struct_info = (msg_struct_t *)calloc(rowCnt, sizeof(MSG_FOLDER_INFO_S *));
+ if (pFolderList->msg_struct_info == NULL){
+ dbHandle->freeTable();
+ return MSG_ERR_NULL_POINTER;
+ }
+
msg_struct_s* pTmp = NULL;
for (int i = 0; i < rowCnt; i++) {
int Sms3gpp2MsgCodec::encodeUserData(const unsigned char* src, unsigned char *dest, int src_size)
{
- int i, j;
+ int i, j = 0;
int shift = 0;
unsigned char *tmp = (unsigned char *)calloc(1, src_size+1);
tmp[i] = src[i] << 1;
}
- j = 0;
+ if (tmp == NULL){
+ MSG_ERR("failed to allocate memory");
+ goto END;
+ }
+
for (i = 0; i < src_size; i++) {
shift = j % 7;
dest[j++] = (tmp[i] << shift) + (tmp[i+1] >> (7-shift));
tmp = NULL;
}
+END:
return j;
}
pAddrlist->msg_struct_info = (msg_struct_t *)calloc(rowCnt, sizeof(msg_struct_t));
+ if (pAddrlist->msg_struct_info == NULL){
+ pDbHandle->freeTable();
+ return MSG_ERR_NULL_POINTER;
+ }
+
for (int i = 0; i < rowCnt; i++) {
pAddrlist->msg_struct_info[i] = (msg_struct_t)new msg_struct_s;
pTmp = (msg_struct_s *)pAddrlist->msg_struct_info[i];
pThreadViewList->msg_struct_info = (msg_struct_t *)calloc(rowCnt, sizeof(msg_struct_t));
+ if (pThreadViewList->msg_struct_info == NULL){
+ dbHandle->freeTable();
+ return MSG_ERR_NULL_POINTER;
+ }
+
MSG_THREAD_VIEW_S *pTmp = NULL;
msg_struct_s *thread_t = NULL;
pConvViewList->msg_struct_info = (msg_struct_t *)calloc(rowCnt, sizeof(msg_struct_t));
memset(pConvViewList->msg_struct_info, 0x00, sizeof(msg_struct_t) * rowCnt);
+ if (pConvViewList->msg_struct_info == NULL){
+ dbHandle->freeTable();
+ return MSG_ERR_NULL_POINTER;
+ }
+
msg_struct_s *conv = NULL;
MSG_CONVERSATION_VIEW_S *pTmp = NULL;
msg_struct_s* pTmp = NULL;
+ if (pRejectMsgList->msg_struct_info == NULL){
+ dbHandle->freeTable();
+ return MSG_ERR_NULL_POINTER;
+ }
+
for (int i = 0; i < rowCnt; i++) {
pRejectMsgList->msg_struct_info[i] = (msg_struct_t)new msg_struct_s;