Browse code

bb11314 fix error check.

Steven Morgan authored on 2015/07/29 06:53:44
Showing 3 changed files
... ...
@@ -4034,7 +4034,7 @@ static int cli_loadyara(FILE *fs, struct cl_engine *engine, unsigned int *signo,
4034 4034
 #ifdef YARA_FINISHED
4035 4035
         return CL_EMALFDB;
4036 4036
 #else
4037
-        if (rc == ERROR_INSUFICIENT_MEMORY)
4037
+        if (compiler.last_result == ERROR_INSUFICIENT_MEMORY)
4038 4038
             return CL_EMEM;
4039 4039
         return CL_SUCCESS;
4040 4040
 #endif
... ...
@@ -2945,8 +2945,10 @@ void yyfatal(
2945 2945
     const char *error_message)
2946 2946
 {
2947 2947
   YR_COMPILER* compiler = yara_yyget_extra(yyscanner);
2948
+  int last_result = compiler->last_result;
2948 2949
 
2949 2950
   yyerror(yyscanner, compiler, error_message);
2951
+  compiler->last_result = last_result;
2950 2952
   longjmp(compiler->error_recovery, 1);
2951 2953
 }
2952 2954
 
... ...
@@ -611,8 +611,10 @@ void yyfatal(
611 611
     const char *error_message)
612 612
 {
613 613
   YR_COMPILER* compiler = yyget_extra(yyscanner);
614
+  int last_result = compiler->last_result;
614 615
 
615 616
   yyerror(yyscanner, compiler, error_message);
617
+  compiler->last_result = last_result;
616 618
   longjmp(compiler->error_recovery, 1);
617 619
 }
618 620