Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.2.4] Fix bugs found by static code analyzers #1393

Merged
merged 22 commits into from Oct 19, 2013
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[FP] Dereference of null pointer
  • Loading branch information
sjinks committed Oct 18, 2013
commit d4fd9d940cc0651c649397f916319dd1d1ce7c11
15 changes: 9 additions & 6 deletions ext/mvc/model/resultset/complex.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, valid){
* The result type=1 so we need to build every row
*/
if (zend_is_true(type)) {

int i_hydrate_mode;
/**
* Get current hydration mode
*/
Expand All @@ -196,8 +196,8 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, valid){
/**
* Each row in a complex result is a Phalcon\Mvc\Model\Row instance
*/

switch (phalcon_get_intval(hydrate_mode)) {
i_hydrate_mode = phalcon_get_intval(hydrate_mode);
switch (i_hydrate_mode) {

case 0:
PHALCON_INIT_VAR(active_row);
Expand Down Expand Up @@ -280,7 +280,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, valid){
* Generate the column value according to the hydration type
*/

switch (phalcon_get_intval(hydrate_mode)) {
switch (i_hydrate_mode) {

case 0:
/**
Expand Down Expand Up @@ -353,12 +353,15 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, valid){
PHALCON_CPY_WRT(attribute, n_alias);
}
}

if (!attribute) {
PHALCON_INIT_NVAR(attribute);
}

/**
* Assign the instance according to the hydration type
*/

switch (phalcon_get_intval(hydrate_mode)) {
switch (i_hydrate_mode) {

case 1:
phalcon_array_update_zval(&active_row, attribute, &value, PH_COPY | PH_SEPARATE);
Expand Down