CVS update: php3/functions

From: Date: Wed, 14 Apr 1999 11:09:51 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-5051@lists.php.net to get a copy of this message
Date: Wednesday April 14, 1999 @ 7:09 Author: fmk Update of /repository/php3/functions In directory asf:/u/temp/cvs-serv15337 Modified Files: head.c Log Message: Fixing alloc and free for _php3_SetCookie(). The function does not free params Index: php3/functions/head.c diff -c php3/functions/head.c:1.115 php3/functions/head.c:1.116 *** php3/functions/head.c:1.115 Tue Apr 13 09:26:13 1999 --- php3/functions/head.c Wed Apr 14 07:09:50 1999 *************** *** 26,32 **** | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> | +----------------------------------------------------------------------+ */ ! /* $Id: head.c,v 1.115 1999/04/13 13:26:13 fmk Exp $ */ #ifdef THREAD_SAFE #include "tls.h" #endif --- 26,32 ---- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> | +----------------------------------------------------------------------+ */ ! /* $Id: head.c,v 1.116 1999/04/14 11:09:50 fmk Exp $ */ #ifdef THREAD_SAFE #include "tls.h" #endif *************** *** 444,450 **** char *r, *dt; #endif #if APACHE ! php3_PushCookieList(name, value, expires, path, domain, secure); #else if (name) len += strlen(name); if (value) len += strlen(value); --- 444,450 ---- char *r, *dt; #endif #if APACHE ! php3_PushCookieList(estrdup(name), estrdup(value), expires, estrdup(path), estrdup(domain), secure); #else if (name) len += strlen(name); if (value) len += strlen(value); *************** *** 468,477 **** r = _php3_urlencode(value, strlen (value)); sprintf(tempstr, "%s=%s", name, value ? r : ""); if (r) efree(r); - if (value) efree(value); - value=NULL; - if (name) efree(name); - name=NULL; if (expires > 0) { strcat(tempstr, "; expires="); dt = php3_std_date(expires); --- 468,473 ---- *************** *** 482,495 **** if (path && strlen(path)) { strcat(tempstr, "; path="); strcat(tempstr, path); - efree(path); - path=NULL; } if (domain && strlen(domain)) { strcat(tempstr, "; domain="); strcat(tempstr, domain); - efree(domain); - domain=NULL; } if (secure) { strcat(tempstr, "; secure"); --- 478,487 ---- *************** *** 518,527 **** PUTS("\015\012"); #endif #endif /* endif SAPI */ - if (domain) efree(domain); - if (path) efree(path); - if (name) efree(name); - if (value) efree(value); efree(tempstr); #endif } --- 510,515 ---- *************** *** 552,570 **** secure = arg[5]->value.lval; case 5: convert_to_string(arg[4]); ! domain = estrndup(arg[4]->value.str.val,arg[4]->value.str.len); case 4: convert_to_string(arg[3]); ! path = estrndup(arg[3]->value.str.val,arg[3]->value.str.len); case 3: convert_to_long(arg[2]); expires = arg[2]->value.lval; case 2: convert_to_string(arg[1]); ! value = estrndup(arg[1]->value.str.val,arg[1]->value.str.len); case 1: convert_to_string(arg[0]); ! name = estrndup(arg[0]->value.str.val,arg[0]->value.str.len); } _php3_SetCookie(name, value, expires, path, domain, secure); } --- 540,558 ---- secure = arg[5]->value.lval; case 5: convert_to_string(arg[4]); ! domain = arg[4]->value.str.val; case 4: convert_to_string(arg[3]); ! path = arg[3]->value.str.val; case 3: convert_to_long(arg[2]); expires = arg[2]->value.lval; case 2: convert_to_string(arg[1]); ! value = arg[1]->value.str.val; case 1: convert_to_string(arg[0]); ! name = arg[0]->value.str.val; } _php3_SetCookie(name, value, expires, path, domain, secure); } -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#5051) next »