} else {
xmlChar* pTotalJobsCount = xmlGetProp(cur, XML_ATTR_JOBS_COUNT);
int totalcount = (pTotalJobsCount == NULL) ? 0 : atoi((char*)pTotalJobsCount);
+ if (pTotalJobsCount != NULL) {
+ xmlFree(pTotalJobsCount);
+ pTotalJobsCount = NULL;
+ }
if (totalcount == 0) {
LOG_LOGD("There is no remained Sync job");
LOG_LOGD("There are one or more registered Sync jobs");
}
}
+ xmlFreeDoc(doc);
}
/* LCOV_EXCL_STOP */
xmlChar* pTotalJobsCount = xmlGetProp(cur, XML_ATTR_JOBS_COUNT);
int totalcount = (pTotalJobsCount == NULL) ? 0 : atoi((char*)pTotalJobsCount);
LOG_LOGD("Total Sync jobs [%d]", totalcount);
+ if (pTotalJobsCount != NULL) {
+ xmlFree(pTotalJobsCount);
+ pTotalJobsCount = NULL;
+ }
if (totalcount == 0) {
ManageIdleState* pManageIdleState = SyncManager::GetInstance()->GetManageIdleState();
cur = cur->xmlChildrenNode;
while (cur != NULL) {
if (!xmlStrcmp(cur->name, XML_NODE_PACKAGE)) {
- xmlChar* pPackageId;
- xmlChar* pJobsCount;
+ xmlChar* pPackageId = NULL;
+ xmlChar* pJobsCount = NULL;
pPackageId = xmlGetProp(cur, XML_ATTR_PACKAGE_ID);
pJobsCount = xmlGetProp(cur, XML_ATTR_JOBS_COUNT);
int count = (pJobsCount == NULL) ? 0 : atoi((char*)pJobsCount);
LOG_LOGD("Sync jobs for package [%s] [%d]", pPackageId, count);
+ if (pJobsCount != NULL)
+ xmlFree(pJobsCount);
xmlNodePtr curJob = cur->xmlChildrenNode;
while (curJob != NULL) {
curJob = curJob->next;
}
+ if (pPackageId != NULL)
+ xmlFree(pPackageId);
}
cur = cur->next;
}
xmlFreeDoc(doc);
return;
} else {
- xmlChar* pSACount;
+ xmlChar* pSACount = NULL;
pSACount = xmlGetProp(cur, XML_ATTR_COUNT);
int count = (pSACount == NULL) ? 0 : atoi((char*)pSACount);
LOG_LOGD("sync adapter count [%d]", count);
-
+ if (pSACount != NULL) {
+ xmlFree(pSACount);
+ pSACount = NULL;
+ }
SyncAdapterAggregator* pAggregator = SyncManager::GetInstance()->GetSyncAdapterAggregator();
cur = cur->xmlChildrenNode;
/* process for removing previous data */
xmlNodePtr rootNode;
-
+ if (doc != NULL) {
+ xmlFreeDoc(doc);
+ doc = NULL;
+ }
doc = xmlNewDoc(_VERSION);
rootNode = xmlNewNode(NULL, XML_NODE_SYNCADAPTERS);
void
RepositoryEngine::ParseExtras(xmlNodePtr cur, bundle* pExtra) {
xmlChar* pKey = xmlGetProp(cur, XML_ATTR_SYNC_EXTRA_KEY);
- xmlChar* pVal = xmlGetProp(cur, XML_ATTR_SYNC_EXTRA_VALUE);
+ if (!pKey)
+ return;
- if (!pKey || !pVal)
+ xmlChar* pVal = xmlGetProp(cur, XML_ATTR_SYNC_EXTRA_VALUE);
+ if (!pVal) {
+ xmlFree(pKey);
return;
+ }
bundle_add_str(pExtra, (const char*)pKey, (const char*)pVal);
}
xmlChar* pJobType = xmlGetProp(cur, XML_ATTR_JOB_TYPE);
xmlChar* pPeriod = xmlGetProp(cur, XML_ATTR_PERIODIC_SYNC_PERIOD);
long period = (pPeriod == NULL)? 1800 : ((atoi((char*)pPeriod) > 1440)? 1440 * 60 : atoi((char*)pPeriod) * 60);
+ if (pPeriod != NULL)
+ xmlFree(pPeriod);
SyncType type = (pJobType == NULL) ? SYNC_TYPE_UNKNOWN : (SyncType)atoi((char*)pJobType);
bool noretry = (pJobNoRetry == NULL) ? false : atoi((char*)pJobNoRetry);
+ if (pJobNoRetry != NULL)
+ xmlFree(pJobNoRetry);
bool expedit = (pJobExpedit == NULL) ? false : atoi((char*)pJobExpedit);
+ if (pJobExpedit != NULL)
+ xmlFree(pJobExpedit);
int accountId = (pAccId == NULL) ? -1 : atoi((char*)pAccId);
+
+ if (pAccId != NULL)
+ xmlFree(pAccId);
+
int syncJobId = -1;
int syncOption = (noretry) ? 0x02 : 0x00;
syncOption |= (expedit) ? 0x01 : 0x00;
}
}
bundle_free(pExtra);
+
+ if (pJobType != NULL) {
+ xmlFree(pJobType);
+ pJobType = NULL;
+ }
+ if (pAppId != NULL) {
+ xmlFree(pAppId);
+ pAppId = NULL;
+ }
}
/* LCOV_EXCL_STOP */