[libgda] Another mem leak correction for bug #680639



commit 783ec0a0b2691c0c0e3325f9d0e0338ae86afad9
Author: Vivien Malerba <malerba gnome-db org>
Date:   Fri Aug 10 21:19:58 2012 +0200

    Another mem leak correction for bug #680639

 libgda/sql-parser/gda-sql-parser.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/libgda/sql-parser/gda-sql-parser.c b/libgda/sql-parser/gda-sql-parser.c
index fade2b4..ab9fc46 100644
--- a/libgda/sql-parser/gda-sql-parser.c
+++ b/libgda/sql-parser/gda-sql-parser.c
@@ -490,12 +490,14 @@ gda_sql_parser_parse_string (GdaSqlParser *parser, const gchar *sql, const gchar
 		switch (parser->priv->context->token_type) {
 		case L_SQLCOMMENT:
 			gda_value_free (value);
+			value = NULL;
 			break;
 		case L_SPACE:
 			if (parser->priv->context->in_param_spec ||
 			    (parser->priv->mode == GDA_SQL_PARSER_MODE_PARSE)) {
 				/* ignore space */
 				gda_value_free (value);
+				value = NULL;
 				break;
 			}
 		default:
@@ -575,10 +577,12 @@ gda_sql_parser_parse_string (GdaSqlParser *parser, const gchar *sql, const gchar
 				  parser_trans [parser->priv->context->token_type]);*/
 				_parse (parser->priv->lemon_parser,
 					parser_trans [parser->priv->context->token_type], value, &piface);
+				value = NULL;
 				break;
 			case GDA_SQL_PARSER_MODE_DELIMIT:
 				_delimit (parser->priv->lemon_delimiter,
 					  delim_trans [parser->priv->context->token_type], value, &piface);
+				value = NULL;
 				break;
 			default:
 				TO_IMPLEMENT;
@@ -594,8 +598,11 @@ gda_sql_parser_parse_string (GdaSqlParser *parser, const gchar *sql, const gchar
 		if (parser->priv->error_pos != 0)
 			break;
 	}
-	if (parser->priv->context->token_type == L_ILLEGAL)
+	if (parser->priv->context->token_type == L_ILLEGAL) {
+		if (value)
+			gda_value_free (value);
 		gda_sql_parser_set_syntax_error (parser);
+	}
 
 	/* send the EOF token to the LEMON parser */
 	switch (parser->priv->mode) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]