Changeset 290 for trunk/ext

Show
Ignore:
Timestamp:
10/24/2007 16:46:32 (13 months ago)
Author:
indeyets
Message:

freeing memory in error-handler

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/ext/php/phpext.c

    r287 r290  
    235235SYMID php_syck_handler(SyckParser *p, SyckNode *n) 
    236236{ 
    237         zval *o; 
     237        zval *o = NULL; 
    238238 
    239239        MAKE_STD_ZVAL(o); 
     
    383383                                char *classname = emalloc(classname_len + 1); 
    384384                                zend_class_entry **ce; 
    385                                 zval *param; 
     385                                zval *param = NULL; 
    386386                                TSRMLS_FETCH(); 
    387387 
     
    422422                                for (i = 0; i < n->data.list->idx; i++) { 
    423423                                        SYMID oid = syck_seq_read(n, i); 
    424                                         zval *o2; 
     424                                        zval *o2 = NULL; 
    425425 
    426426                                        syck_lookup_sym(p, oid, (char **) &o2); /* retrieving child-node */ 
     
    449449                                        for (i = 0; i < n->data.list->idx; i++) { 
    450450                                                SYMID oid = syck_seq_read(n, i); 
    451                                                 zval *o2; 
    452                                                 zval *key; 
     451                                                zval *o2 = NULL; 
     452                                                zval *key = NULL; 
    453453 
    454454                                                syck_lookup_sym(p, oid, (char **) &o2); /* retrieving child-node */ 
     
    486486                                SYMID oid; 
    487487                                size_t i; 
    488                                 zval *o2, *o3; 
    489                                 zval *res; 
     488                                zval *o2 = NULL, *o3 = NULL; 
     489                                zval *res = NULL; 
    490490 
    491491                                array_init(o); 
     
    512512                                SYMID oid; 
    513513                                size_t i; 
    514                                 zval *o2, *o3; 
     514                                zval *o2 = NULL, *o3 = NULL; 
    515515                                size_t classname_len = strlen(n->type_id) - 10; 
    516516                                char *classname = emalloc(classname_len + 1); 
     
    583583} 
    584584 
     585enum st_retval my_cleaner(char *key, char *value, char *smth) 
     586{ 
     587        zval *ptr = (zval *)value; 
     588 
     589        zval_ptr_dtor(&ptr); 
     590        return ST_DELETE; 
     591} 
     592 
    585593void php_syck_ehandler(SyckParser *p, const char *str) 
    586594{ 
     
    594602 
    595603        zend_throw_exception_ex(syck_exception_entry, 0 TSRMLS_CC, "%s on line %d, col %d: '%s'", str, p->linect, p->cursor - p->lineptr, p->lineptr); 
     604 
     605        st_foreach(p->syms, my_cleaner, NULL); 
    596606} 
    597607 
     
    656666 
    657667                                for (zend_hash_internal_pointer_reset(tbl); zend_hash_has_more_elements(tbl) == SUCCESS; zend_hash_move_forward(tbl)) { 
    658                                         zval **ppzval; 
     668                                        zval **ppzval = NULL; 
    659669 
    660670                                        zend_hash_get_current_data(tbl, (void **)&ppzval); 
     
    674684 
    675685                                for (zend_hash_internal_pointer_reset(tbl); zend_hash_has_more_elements(tbl) == SUCCESS; zend_hash_move_forward(tbl)) { 
    676                                         zval **ppzval; 
     686                                        zval **ppzval = NULL; 
    677687 
    678688                                        zend_hash_get_current_data(tbl, (void **)&ppzval); 
     
    692702 
    693703                                for (zend_hash_internal_pointer_reset(tbl); zend_hash_has_more_elements(tbl) == SUCCESS; zend_hash_move_forward(tbl)) { 
    694                                         zval **ppzval, kzval; 
     704                                        zval **ppzval = NULL, kzval; 
    695705                                        char *key; 
    696706                                        uint key_len; 
     
    744754                        /* DateTime is encoded as timestamp */ 
    745755                        if (strncmp(name, "DateTime", name_len) == 0) { 
    746                                 zval *retval; 
     756                                zval *retval = NULL; 
    747757                                zval constant; 
    748758 
     
    760770                                        size_t prefix_len = strlen(prefix) + 1; 
    761771                                        char *tagname = emalloc(name_len + prefix_len); 
    762                                         zval *serialized; 
     772                                        zval *serialized = NULL; 
    763773 
    764774                                        snprintf(tagname, name_len + prefix_len, "%s%s", prefix, name); 
     
    795805        int arg_len; 
    796806        SYMID v; 
    797         zval *obj; 
     807        zval *obj = NULL; 
    798808        SyckParser *parser; 
    799809 
     
    824834                zval_ptr_dtor(&obj); 
    825835        } 
     836 
    826837 
    827838        syck_free_parser(parser);