From: Ilia Alshanetsky Date: Sun, 22 Dec 2002 20:16:37 +0000 (+0000) Subject: Fixed various memory leaks. X-Git-Tag: PHP_5_0_dev_before_13561_fix~628 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=af55703d5252dd7000bfb2542492bcc5d511b2cc;p=php Fixed various memory leaks. # Should this be MFHed? --- diff --git a/ext/ncurses/ncurses_functions.c b/ext/ncurses/ncurses_functions.c index 68b8fb96d7..940ee9a45d 100644 --- a/ext/ncurses/ncurses_functions.c +++ b/ext/ncurses/ncurses_functions.c @@ -235,12 +235,14 @@ PHP_FUNCTION(ncurses_move) 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_pnoutrefresh) 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 @@ PHP_FUNCTION(ncurses_new_panel) { 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 @@ PHP_FUNCTION(ncurses_panel_window) { 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) {