Skip to content

Commit

Permalink
fix #182. Don't segfault on queries with invalid limit clause.
Browse files Browse the repository at this point in the history
  • Loading branch information
jvshahid committed Jan 15, 2014
1 parent d594a96 commit c6cb4c8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@
- [Issue #145](https://github.com/influxdb/influxdb/issues/145). Server fails to join cluster if all starting at same time.
- [Issue #176](https://github.com/influxdb/influxdb/issues/176). Drop database should take effect on all nodes
- [Issue #180](https://github.com/influxdb/influxdb/issues/180). Column names not returned when running multi-node cluster and writing more than one point.
- [Issue #182](https://github.com/influxdb/influxdb/issues/182). Queries with invalid limit clause crash the server

### Deprecated

Expand Down
3 changes: 3 additions & 0 deletions src/parser/frees.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ free_value_array(value_array *array)
void
free_groupby_clause(groupby_clause *g)
{
if (!g)
return;

free_value_array(g->elems);
if (g->fill_function) {
free_value(g->fill_function);
Expand Down
5 changes: 5 additions & 0 deletions src/parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,11 @@ func (self *QueryParserSuite) TestParseWhereClauseParentheses(c *C) {
c.Assert(third.Name, Equals, ">")
}

func (self *QueryParserSuite) TestParseSelectWithInvalidLimit(c *C) {
_, err := ParseSelectQuery("select value from t limit;")
c.Assert(err, NotNil)
}

func (self *QueryParserSuite) TestParseSelectWithOrderByAndLimit(c *C) {
q, err := ParseSelectQuery("select value from t order asc limit 10;")
c.Assert(err, IsNil)
Expand Down
3 changes: 3 additions & 0 deletions src/parser/test_memory_leaks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ int main(int argc, char **argv) {
q = parse_query("drop series foobar");
close_query(&q);
q = parse_query("select * from foobar limit");
close_query(&q);
return 0;
}
EOF
Expand Down

0 comments on commit c6cb4c8

Please sign in to comment.