[Forensics-changes] [yara] 295/368: Add missing call to va_end

Hilko Bengen bengen at moszumanska.debian.org
Sat Jul 1 10:30:49 UTC 2017


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag v3.5.0
in repository yara.

commit b5e762a98760511588067f76d92730c0a668cd36
Author: plusvic <plusvic at gmail.com>
Date:   Fri Jun 3 12:14:46 2016 +0200

    Add missing call to va_end
---
 libyara/lexer.c | 14 ++++++++------
 libyara/lexer.l |  4 +++-
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/libyara/lexer.c b/libyara/lexer.c
index fec474a..3af3d37 100644
--- a/libyara/lexer.c
+++ b/libyara/lexer.c
@@ -243,7 +243,7 @@ struct yy_buffer_state
 	/* Number of characters read into yy_ch_buf, not including EOB
 	 * characters.
 	 */
-	int yy_n_chars;
+	yy_size_t yy_n_chars;
 
 	/* Whether we "own" the buffer - i.e., we know we created it,
 	 * and can realloc() it to grow it, and should free() it to
@@ -830,7 +830,7 @@ struct yyguts_t
     size_t yy_buffer_stack_max; /**< capacity of stack. */
     YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
     char yy_hold_char;
-    int yy_n_chars;
+    yy_size_t yy_n_chars;
     yy_size_t yyleng_r;
     char *yy_c_buf_p;
     int yy_init;
@@ -2146,9 +2146,9 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 	else
 		ret_val = EOB_ACT_CONTINUE_SCAN;
 
-	if ((int) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+	if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
 		/* Extend the array by 50%, plus the number we really need. */
-		int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
+		yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
 		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yara_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
 		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
 			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
@@ -2548,7 +2548,7 @@ static void yara_yyensure_buffer_stack (yyscan_t yyscanner)
 		 * scanner will even need a stack. We use 2 instead of 1 to avoid an
 		 * immediate realloc on the next call.
          */
-		num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
+		num_to_alloc = 1; // After all that talk, this was set to 1 anyways...
 		yyg->yy_buffer_stack = (struct yy_buffer_state**)yara_yyalloc
 								(num_to_alloc * sizeof(struct yy_buffer_state*)
 								, yyscanner);
@@ -3053,7 +3053,7 @@ void yywarning(
 
   char* file_name;
   char message[512];
-  
+
   va_list message_args;
   va_start(message_args, message_fmt);
 
@@ -3073,6 +3073,8 @@ void yywarning(
       yara_yyget_lineno(yyscanner),
       message,
       compiler->user_data);
+
+  va_end(message_args);
 }
 
 
diff --git a/libyara/lexer.l b/libyara/lexer.l
index c33c93c..4f4c164 100644
--- a/libyara/lexer.l
+++ b/libyara/lexer.l
@@ -631,7 +631,7 @@ void yywarning(
 
   char* file_name;
   char message[512];
-  
+
   va_list message_args;
   va_start(message_args, message_fmt);
 
@@ -651,6 +651,8 @@ void yywarning(
       yyget_lineno(yyscanner),
       message,
       compiler->user_data);
+
+  va_end(message_args);
 }
 
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/yara.git



More information about the forensics-changes mailing list