Browse code

hs api upgrade

aCaB authored on 2010/01/05 01:05:37
Showing 2 changed files
... ...
@@ -872,10 +872,7 @@ int cli_ac_initdata(struct cli_ac_data *data, uint32_t partsigs, uint32_t lsigs,
872 872
 	return CL_ENULLARG;
873 873
     }
874 874
 
875
-    if(cli_hashset_init(&data->vinfo, 32, 80)) {
876
-	cli_errmsg("cli_ac_init: Can't allocate vinfo hashtab\n");
877
-	return CL_EMEM;
878
-    }
875
+    cli_hashset_init_noalloc(&data->vinfo);
879 876
 
880 877
     data->reloffsigs = reloffsigs;
881 878
     if(reloffsigs) {
... ...
@@ -1081,7 +1078,7 @@ int cli_ac_scanbuff(const unsigned char *buffer, uint32_t length, const char **v
1081 1081
 			realoff = offset + bp - pt->prefix_length;
1082 1082
 			if(patt->offdata[0] == CLI_OFF_VERSION) {
1083 1083
 			    cli_errmsg("CHECK: %x\n", realoff);
1084
-			    if(!cli_hashset_contains(&mdata->vinfo, realoff)) {
1084
+			    if(!cli_hashset_contains_maybe_noalloc(&mdata->vinfo, realoff)) {
1085 1085
 				pt = pt->next_same;
1086 1086
 				continue;
1087 1087
 			    }
... ...
@@ -2405,7 +2405,14 @@ int cli_peheader(fmap_t *map, struct cli_exe_info *peinfo)
2405 2405
 	return -1;
2406 2406
     }
2407 2407
 
2408
-    
2408
+    if(cli_hashset_init(&peinfo->vinfo, 32, 80)) {
2409
+	cli_errmsg("Unable to init vinfo hs\n");
2410
+	free(section_hdr);
2411
+	free(peinfo->section);
2412
+	peinfo->section = NULL;
2413
+	return -1;
2414
+    }
2415
+
2409 2416
     if(dirs[2].Size) {
2410 2417
     	uint32_t rvas, res_sz;
2411 2418
 	uint8_t *vptr, *baseptr;