]> granicus.if.org Git - php/commitdiff
possible memoryleak
authorMarcus Boerger <helly@php.net>
Fri, 9 Aug 2002 20:53:37 +0000 (20:53 +0000)
committerMarcus Boerger <helly@php.net>
Fri, 9 Aug 2002 20:53:37 +0000 (20:53 +0000)
ext/standard/head.c

index 81236de73710ba260119ca18e67f4be19f802007..9279bf2b010c8ca01a2af1d4a5a66f4d7a87a05c 100644 (file)
@@ -69,6 +69,7 @@ PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, t
        time_t t;
        char *dt;
        sapi_header_line ctr = {0};
+       int result;
        
        len += name_len;
        if (value) {
@@ -124,7 +125,11 @@ PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, t
        ctr.line = cookie;
        ctr.line_len = strlen(cookie);
 
-       return sapi_header_op(SAPI_HEADER_ADD, &ctr TSRMLS_CC);
+       result = sapi_header_op(SAPI_HEADER_ADD, &ctr TSRMLS_CC);
+       if (result == FAILURE) {
+               efree(cookie);
+       }
+       return result;
 }