Reset cluster_sql on parser entry.
authorMarko Kreen <markokr@gmail.com>
Wed, 14 May 2008 12:15:54 +0000 (12:15 +0000)
committerMarko Kreen <markokr@gmail.com>
Wed, 14 May 2008 12:15:54 +0000 (12:15 +0000)
Fixes crash in case CLUSTER 'name'; follows CLUSTER func();

src/parser.y

index 85f439f477e6d7b0c64fae2949d7d725c6041d2b..9f19de248bab98f11af3b7cde281ad321d9b8ce9 100644 (file)
@@ -146,9 +146,10 @@ void yyerror(const char *fmt, ...)
 void plproxy_run_parser(ProxyFunction *func, const char *body, int len)
 {
        xfunc = func;
-       got_run = got_cluster = got_connect = 0;
 
-       cur_sql = select_sql = NULL;
+       /* reset variables, in case there was error exit */
+       got_run = got_cluster = got_connect = 0;
+       cur_sql = select_sql = cluster_sql = hash_sql = NULL;
 
        /* setup scanner */
        plproxy_yy_scan_bytes(body, len);
@@ -182,5 +183,6 @@ void plproxy_run_parser(ProxyFunction *func, const char *body, int len)
                xfunc->cluster_sql = plproxy_query_finish(cluster_sql);
 
        xfunc = NULL;
+       cur_sql = select_sql = cluster_sql = hash_sql = NULL;
 }