Skip to content

Commit

Permalink
‘phql_key’ may be used uninitialized in this function
Browse files Browse the repository at this point in the history
  • Loading branch information
sjinks committed Aug 1, 2013
1 parent fdaa645 commit 2b8f420
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions ext/mvc/model/query/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ int phql_internal_parse_phql(zval **result, char *phql, unsigned int phql_length

zend_phalcon_globals *phalcon_globals_ptr = PHALCON_VGLOBAL;
phql_parser_status *parser_status = NULL;
int scanner_status, status = SUCCESS, error_length;
int scanner_status, status = SUCCESS, error_length, cache_level;
phql_scanner_state *state;
phql_scanner_token token;
unsigned long phql_key;
unsigned long phql_key = 0;
void* phql_parser;
char *error;
zval **temp_ast;
Expand All @@ -180,7 +180,8 @@ int phql_internal_parse_phql(zval **result, char *phql, unsigned int phql_length
return FAILURE;
}

if (phalcon_globals_ptr->orm.cache_level >= 0) {
cache_level = phalcon_globals_ptr->orm.cache_level;
if (cache_level >= 0) {

phql_key = zend_inline_hash_func(phql, phql_length + 1);

Expand Down Expand Up @@ -538,7 +539,7 @@ int phql_internal_parse_phql(zval **result, char *phql, unsigned int phql_length
/**
* Store the parsed definition in the cache
*/
if (phalcon_globals_ptr->orm.cache_level >= 0) {
if (cache_level >= 0) {

if (!phalcon_globals_ptr->orm.parser_cache) {
ALLOC_HASHTABLE(phalcon_globals_ptr->orm.parser_cache);
Expand Down
9 changes: 5 additions & 4 deletions ext/mvc/model/query/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -3053,10 +3053,10 @@ int phql_internal_parse_phql(zval **result, char *phql, unsigned int phql_length

zend_phalcon_globals *phalcon_globals_ptr = PHALCON_VGLOBAL;
phql_parser_status *parser_status = NULL;
int scanner_status, status = SUCCESS, error_length;
int scanner_status, status = SUCCESS, error_length, cache_level;
phql_scanner_state *state;
phql_scanner_token token;
unsigned long phql_key;
unsigned long phql_key = 0;
void* phql_parser;
char *error;
zval **temp_ast;
Expand All @@ -3067,7 +3067,8 @@ int phql_internal_parse_phql(zval **result, char *phql, unsigned int phql_length
return FAILURE;
}

if (phalcon_globals_ptr->orm.cache_level >= 0) {
cache_level = phalcon_globals_ptr->orm.cache_level;
if (cache_level >= 0) {

phql_key = zend_inline_hash_func(phql, phql_length + 1);

Expand Down Expand Up @@ -3425,7 +3426,7 @@ int phql_internal_parse_phql(zval **result, char *phql, unsigned int phql_length
/**
* Store the parsed definition in the cache
*/
if (phalcon_globals_ptr->orm.cache_level >= 0) {
if (cache_level >= 0) {

if (!phalcon_globals_ptr->orm.parser_cache) {
ALLOC_HASHTABLE(phalcon_globals_ptr->orm.parser_cache);
Expand Down

0 comments on commit 2b8f420

Please sign in to comment.