Looks safe to me.
On Sun, 22 Dec 2002, Ilia Alshanetsky wrote:
> iliaa Sun Dec 22 15:16:37 2002 EDT
>
> Modified files:
> /php4/ext/ncurses ncurses_functions.c
> Log:
> Fixed various memory leaks.
>
> # Should this be MFHed?
>
>
> Index: php4/ext/ncurses/ncurses_functions.c
> diff -u php4/ext/ncurses/ncurses_functions.c:1.31
>php4/ext/ncurses/ncurses_functions.c:1.32
> --- php4/ext/ncurses/ncurses_functions.c:1.31 Sun Dec 22 14:51:49 2002
> +++ php4/ext/ncurses/ncurses_functions.c Sun Dec 22 15:16:37 2002
> @@ -235,12 +235,14 @@
> PHP_FUNCTION(ncurses_newpad)
> {
> long rows,cols;
> - WINDOW **pwin = (WINDOW **)emalloc(sizeof(WINDOW *));
> + WINDOW **pwin;
>
> if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
>"ll",&rows,&cols)==FAILURE) {
> return;
> }
> IS_NCURSES_INITIALIZED();
> +
> + pwin = (WINDOW **)emalloc(sizeof(WINDOW *));
> *pwin = newpad(rows,cols);
>
> if(!*pwin) {
> @@ -298,13 +300,14 @@
> PHP_FUNCTION(ncurses_newwin)
> {
> long rows,cols,y,x;
> - WINDOW **pwin = (WINDOW **)emalloc(sizeof(WINDOW *));
> + WINDOW **pwin;
>
> if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
>"llll",&rows,&cols,&y,&x)==FAILURE) {
> return;
> }
>
> IS_NCURSES_INITIALIZED();
> + pwin = (WINDOW **)emalloc(sizeof(WINDOW *));
> *pwin=newwin(rows,cols,y,x);
>
> if(!*pwin) {
> @@ -2249,13 +2252,14 @@
> {
> zval **handle;
> WINDOW **win;
> - PANEL **panel = (PANEL **)emalloc(sizeof(PANEL *));
> + PANEL **panel;
>
> if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &handle) == FAILURE)
> WRONG_PARAM_COUNT;
>
> FETCH_WINRES(win, handle);
>
> + panel = (PANEL **)emalloc(sizeof(PANEL *));
> *panel = new_panel(*win);
>
> if (*panel == NULL) {
> @@ -2455,13 +2459,15 @@
> {
> zval *phandle = NULL;
> PANEL **panel;
> - WINDOW **win = (WINDOW **)emalloc(sizeof(WINDOW *));
> + WINDOW **win;
>
> if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r",
>&phandle)) {
> return;
> }
>
> FETCH_PANEL(panel, &phandle);
> +
> + win = (WINDOW **)emalloc(sizeof(WINDOW *));
> *win = panel_window(*panel);
>
> if (*win == NULL) {
>
>
>
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
-Andrei http://www.gravitonic.com/
* Life may be expensive, but it includes an annual free trip around the sun. *
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php