Fix a potential leak in the query-parser.

This commit is contained in:
alexhudson
2009-05-31 12:45:55 +00:00
parent b95822f9ef
commit dd158ea55a
2 changed files with 5 additions and 1 deletions
+4 -1
View File
@@ -15,6 +15,7 @@
* Parser of Store Protocol queries into structures, for later use in SQL queries
*/
#include "stored.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -151,7 +152,7 @@ QueryParserRun(struct parser_state *state)
char *token;
struct expression *current_expression = state->start;
while (pull_token(&(state->query), &token) != -1) {
while (pull_token(&(state->query_ptr), &token) != -1) {
if (current_expression < state->start) {
// ran off the top of our stack, but there were still tokens
DEBUG_MESSAGE("ERR: tokens remaining in data\n");
@@ -261,6 +262,8 @@ QueryParserStart(struct parser_state *state, const char *query, int max_expr) {
return -2;
}
state->query_ptr = state->query;
return 0;
}
+1
View File
@@ -21,6 +21,7 @@ struct parser_state {
struct expression *last;
int entries;
char *query;
char *query_ptr;
};
int QueryParserStart(struct parser_state *state, const char *query, int max_expr);