- Timestamp:
- Dec 28, 2012, 12:41:25 AM (12 years ago)
- Location:
- trunk/zoo-project/zoo-kernel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/zoo_loader.c
r380 r381 83 83 #endif 84 84 85 char *strQuery=strdup(cgiQueryString); 85 86 char *strQuery=NULL; 87 if(cgiQueryString!=NULL) 88 strQuery=strdup(cgiQueryString); 86 89 map* tmpMap=NULL; 87 90 … … 93 96 char *res=NULL; 94 97 int r=0; 95 while( r=fread(buffer,sizeof(char),1,cgiIn)){98 while((r=fread(buffer,sizeof(char),1,cgiIn))){ 96 99 cgiContentLength+=r; 97 100 if(res==NULL){ … … 115 118 char *buffer=new char[cgiContentLength+1]; 116 119 int r=0; 117 if( (r=fread(buffer,sizeof(char),cgiContentLength,cgiIn))!=0){120 if(fread(buffer,sizeof(char),cgiContentLength,cgiIn)>=0){ 118 121 buffer[cgiContentLength]=0; 119 122 tmpMap=createMap("request",buffer); … … 196 199 xmlDocPtr doc = xmlParseMemory(t1->value,cgiContentLength); 197 200 198 199 201 { 200 202 xmlXPathObjectPtr reqptr=extractFromDoc(doc,"/*[local-name()='Envelope']/*[local-name()='Body']/*"); … … 244 246 xmlXPathFreeObject(reqptr); 245 247 } 246 //xmlFree(req);247 248 } 248 249 if(strncasecmp(t1->value,"GetCapabilities",15)==0){ … … 252 253 addToMap(tmpMap,"version",(char*)content); 253 254 xmlXPathFreeObject(versptr); 254 //xmlFree(vers);255 255 xmlFree(content); 256 256 }else{ … … 259 259 if(tval!=NULL) 260 260 addToMap(tmpMap,"version",tval); 261 xmlFree(tval);262 261 tval = (char*) xmlGetProp(cur,BAD_CAST "language"); 263 262 if(tval!=NULL) … … 287 286 } 288 287 } 289 //xmlFree(id); 290 } 291 xmlFree(tval); 288 } 292 289 xmlFreeDoc(doc); 293 290 xmlCleanupParser(); … … 329 326 } 330 327 328 if(strQuery!=NULL) 329 free(strQuery); 331 330 runRequest(tmpMap); 332 331 -
trunk/zoo-project/zoo-kernel/zoo_service_loader.c
r380 r381 522 522 * Parsing service specfic configuration file 523 523 */ 524 m=(maps*) calloc(1,MAPS_SIZE);524 m=(maps*)malloc(MAPS_SIZE); 525 525 if(m == NULL){ 526 526 return errorException(m, _("Unable to allocate memory."), "InternalError"); … … 533 533 #endif 534 534 r_inputs=getMapOrFill(request_inputs,"metapath",""); 535 535 536 536 537 char conf_file[10240]; … … 551 552 bindtextdomain ("zoo-services","/usr/share/locale/"); 552 553 } 554 553 555 554 556 /** … … 597 599 else 598 600 setMapInMaps(m,"main","isSoap","false"); 601 599 602 600 603 /** … … 698 701 memset(tmps1,0,1024); 699 702 snprintf(tmps1,1024,"%s/%s",conf_dir,dp->d_name); 700 s1=(service*) calloc(1,SERVICE_SIZE);703 s1=(service*)malloc(SERVICE_SIZE); 701 704 if(s1 == NULL){ 702 705 return errorException(m, _("Unable to allocate memory."),"InternalError"); … … 782 785 memset(buff1,0,1024); 783 786 snprintf(buff1,1024,"%s/%s",conf_dir,dp->d_name); 784 s1=(service*) calloc(1,SERVICE_SIZE);787 s1=(service*)malloc(SERVICE_SIZE); 785 788 if(s1 == NULL){ 786 789 dup2(saved_stdout,fileno(stdout)); … … 830 833 831 834 s1=NULL; 832 s1=(service*) calloc(1,SERVICE_SIZE);835 s1=(service*)malloc(SERVICE_SIZE); 833 836 if(s1 == NULL){ 834 837 freeMaps(&m); … … 876 879 int j; 877 880 881 878 882 /** 879 883 * Create the input and output maps data structure … … 931 935 #endif 932 936 pToken=strtok(cursor_output,";"); 933 char** outputs_as_text=(char**) calloc(128,sizeof(char*));937 char** outputs_as_text=(char**)malloc(128*sizeof(char*)); 934 938 if(outputs_as_text == NULL) { 935 939 return errorException(m, _("Unable to allocate memory"), "InternalError"); … … 942 946 fprintf(stderr,"***%s***\n",pToken); 943 947 #endif 944 outputs_as_text[i]=(char*) calloc(strlen(pToken)+1,sizeof(char));948 outputs_as_text[i]=(char*)malloc((strlen(pToken)+1)*sizeof(char)); 945 949 if(outputs_as_text[i] == NULL) { 946 950 return errorException(m, _("Unable to allocate memory"), "InternalError"); … … 959 963 if(k==0){ 960 964 if(tmp_output==NULL){ 961 tmp_output=(maps*) calloc(1,MAPS_SIZE);965 tmp_output=(maps*)malloc(MAPS_SIZE); 962 966 if(tmp_output == NULL){ 963 967 return errorException(m, _("Unable to allocate memory."), "InternalError"); … … 1044 1048 free(tmp1); 1045 1049 1046 char** inputs_as_text=(char**) calloc(100,sizeof(char*));1050 char** inputs_as_text=(char**)malloc(100*sizeof(char*)); 1047 1051 if(inputs_as_text == NULL){ 1048 1052 return errorException(m, _("Unable to allocate memory."), "InternalError"); … … 1057 1061 fprintf(stderr,"***%s***\n",pToken); 1058 1062 #endif 1059 inputs_as_text[i]=(char*) calloc(strlen(pToken)+1,sizeof(char));1063 inputs_as_text[i]=(char*)malloc((strlen(pToken)+1)*sizeof(char)); 1060 1064 snprintf(inputs_as_text[i],strlen(pToken)+1,"%s",pToken); 1061 1065 if(inputs_as_text[i] == NULL){ … … 1090 1094 #endif 1091 1095 if(tmpmaps==NULL){ 1092 tmpmaps=(maps*) calloc(1,MAPS_SIZE);1096 tmpmaps=(maps*)malloc(MAPS_SIZE); 1093 1097 if(tmpmaps == NULL){ 1094 1098 return errorException(m, _("Unable to allocate memory."), "InternalError"); … … 1124 1128 tmpn1[strlen(tmpc)]=0; 1125 1129 map* lmap=getLastMap(tmpmaps->content); 1126 char *tmpValue=(char*) calloc((strlen(tmpv)+strlen(tmpc)+1),sizeof(char));1130 char *tmpValue=(char*)malloc((strlen(tmpv)+strlen(tmpc)+1)*sizeof(char)); 1127 1131 sprintf(tmpValue,"%s@%s",tmpv+1,tmpc); 1128 1132 free(lmap->value); … … 1260 1264 xmlChar *val= xmlNodeListGetString(doc,cur2->xmlChildrenNode,1); 1261 1265 if(tmpmaps==NULL){ 1262 tmpmaps=(maps*) calloc(1,MAPS_SIZE);1266 tmpmaps=(maps*)malloc(MAPS_SIZE); 1263 1267 if(tmpmaps == NULL){ 1264 1268 return errorException(m, _("Unable to allocate memory."), "InternalError"); … … 1278 1282 xmlNodeListGetString(doc,cur2->xmlChildrenNode,1); 1279 1283 if(tmpmaps==NULL){ 1280 tmpmaps=(maps*) calloc(1,MAPS_SIZE);1284 tmpmaps=(maps*)malloc(MAPS_SIZE); 1281 1285 if(tmpmaps == NULL){ 1282 1286 return errorException(m, _("Unable to allocate memory."), "InternalError"); … … 1365 1369 #endif 1366 1370 if(hai==0){ 1367 key=(char*) calloc((1+strlen((char*)val)),sizeof(char));1371 key=(char*)malloc((1+strlen((char*)val))*sizeof(char)); 1368 1372 snprintf(key,1+strlen((char*)val),"%s",(char*)val); 1369 1373 }else{ 1370 has=(char*) calloc((3+strlen((char*)val)+strlen(key)),sizeof(char));1374 has=(char*)malloc((3+strlen((char*)val)+strlen(key))*sizeof(char)); 1371 1375 if(has == NULL){ 1372 1376 return errorException(m, _("Unable to allocate memory."), "InternalError"); … … 1417 1421 res=InternetOpenUrl(hInternet,btmp->value,tmp,strlen(tmp), 1418 1422 INTERNET_FLAG_NO_CACHE_WRITE,0); 1419 char* tmpContent = (char*) calloc((res.nDataLen+1),sizeof(char));1423 char* tmpContent = (char*)malloc((res.nDataLen+1)*sizeof(char)); 1420 1424 if(tmpContent == NULL){ 1421 1425 return errorException(m, _("Unable to allocate memory."), "InternalError"); … … 1452 1456 INTERNET_FLAG_NO_CACHE_WRITE,0); 1453 1457 char* tmp= 1454 (char*) calloc((res1.nDataLen+1),sizeof(char));1458 (char*)malloc((res1.nDataLen+1)*sizeof(char)); 1455 1459 if(tmp == NULL){ 1456 1460 return errorException(m, _("Unable to allocate memory."), "InternalError"); … … 1470 1474 strlen(tmp), 1471 1475 INTERNET_FLAG_NO_CACHE_WRITE,0); 1472 char* tmpContent = (char*) calloc((res.nDataLen+1),sizeof(char));1476 char* tmpContent = (char*)malloc((res.nDataLen+1)*sizeof(char)); 1473 1477 if(tmpContent == NULL){ 1474 1478 return errorException(m, _("Unable to allocate memory."), "InternalError"); … … 1688 1692 */ 1689 1693 if(tmpmaps==NULL){ 1690 tmpmaps=(maps*) calloc(1,MAPS_SIZE);1694 tmpmaps=(maps*)malloc(MAPS_SIZE); 1691 1695 if(tmpmaps == NULL){ 1692 1696 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1693 1697 } 1694 1698 tmpmaps->name=strdup("unknownIdentifier"); 1699 tmpmaps->content=NULL; 1695 1700 tmpmaps->next=NULL; 1696 1701 } … … 1719 1724 } 1720 1725 xmlNodePtr cur1=cur->children; 1726 while(cur1!=NULL && cur1->type != XML_ELEMENT_NODE) 1727 cur1=cur1->next; 1721 1728 while(cur1){ 1722 1729 /** … … 1727 1734 xmlNodeListGetString(doc,cur1->xmlChildrenNode,1); 1728 1735 if(tmpmaps==NULL){ 1729 tmpmaps=(maps*) calloc(1,MAPS_SIZE);1736 tmpmaps=(maps*)malloc(MAPS_SIZE); 1730 1737 if(tmpmaps == NULL){ 1731 1738 return errorException(m, _("Unable to allocate memory."), "InternalError"); … … 1747 1754 xmlNodeListGetString(doc,cur1->xmlChildrenNode,1); 1748 1755 if(tmpmaps==NULL){ 1749 tmpmaps=(maps*) calloc(1,MAPS_SIZE);1756 tmpmaps=(maps*)malloc(MAPS_SIZE); 1750 1757 if(tmpmaps == NULL){ 1751 1758 return errorException(m, _("Unable to allocate memory."), "InternalError"); … … 1787 1794 xmlFree(val); 1788 1795 } 1789 1790 1796 xmlNodePtr cur2=cur1->children; 1791 1797 while(cur2){ … … 1797 1803 xmlNodeListGetString(doc,cur2->xmlChildrenNode,1); 1798 1804 if(tmpmaps==NULL){ 1799 tmpmaps=(maps*) calloc(1,MAPS_SIZE);1805 tmpmaps=(maps*)malloc(MAPS_SIZE); 1800 1806 if(tmpmaps == NULL){ 1801 1807 return errorException(m, _("Unable to allocate memory."), "InternalError"); … … 1820 1826 xmlNodeListGetString(doc,cur2->xmlChildrenNode,1); 1821 1827 if(tmpmaps==NULL){ 1822 tmpmaps=(maps*) calloc(1,MAPS_SIZE);1828 tmpmaps=(maps*)malloc(MAPS_SIZE); 1823 1829 if(tmpmaps == NULL){ 1824 1830 return errorException(m, _("Unable to allocate memory."), "InternalError"); … … 1858 1864 } 1859 1865 } 1860 1861 1866 xmlXPathFreeObject(tmpsptr); 1862 1867 xmlCleanupParser(); … … 2096 2101 sprintf(session_file_path,"%s/sess_%s.cfg",tmpPath->value,strstr(cgiCookie,"=")+1); 2097 2102 free(tcook); 2098 maps *tmpSess=(maps*) calloc(1,MAPS_SIZE);2103 maps *tmpSess=(maps*)malloc(MAPS_SIZE); 2099 2104 struct stat file_status; 2100 2105 int istat = stat(session_file_path, &file_status);
Note: See TracChangeset
for help on using the changeset viewer.