Fix #23: Segmentation fault after fann_destroy

Esse commit está contido em:
Jakub Zelenka
2016-05-31 20:35:42 +01:00
commit 39d169640e
3 arquivos alterados com 23 adições e 3 exclusões
+2 -2
Ver Arquivo
@@ -1620,7 +1620,7 @@ PHP_FUNCTION(fann_destroy)
return;
}
RETURN_BOOL(PHPC_RES_DELETE(z_ann) == SUCCESS);
RETURN_BOOL(PHPC_RES_CLOSE(z_ann) == SUCCESS);
}
/* }}} */
@@ -2245,7 +2245,7 @@ PHP_FUNCTION(fann_destroy_train)
return;
}
RETURN_BOOL(PHPC_RES_DELETE(z_train_data) == SUCCESS);
RETURN_BOOL(PHPC_RES_CLOSE(z_train_data) == SUCCESS);
}
/* }}} */
+1 -1
Submodule phpc updated: 0dc25eab0f...30c563db2e
+20
Ver Arquivo
@@ -0,0 +1,20 @@
--TEST--
Test bug
--FILE--
<?php
$num_input = 2;
$num_output = 1;
$num_layers = 3;
$num_neurons_hidden = 3;
$ann = fann_create_standard($num_layers, $num_input, $num_neurons_hidden, $num_output);
// destroy is the key - there is no segfault without it
fann_destroy($ann);
$ann = fann_create_standard($num_layers, $num_input, $num_neurons_hidden, $num_output);
var_dump($ann);
// now any accesss will segfault
var_dump(fann_get_errno($ann));
?>
--EXPECTF--
resource(%d) of type (FANN)
int(0)