Changeset 191 for trunk

Show
Ignore:
Timestamp:
09/03/07 19:39:27 (15 months ago)
Author:
zany
Message:

fixing off-by-one and unfreed mem

Location:
trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/apps/obexftp.c

    r186 r191  
    586586                                        st = obexftp_stat(cli, ent->name); 
    587587                                        if (!st) continue; 
    588                                         printf("%d %s (%d)\n", st->size, ent->name, ent->mode); 
     588                                        printf("%d %s%s\n", st->size, ent->name, 
     589                                                ent->mode&S_IFDIR?"/":""); 
    589590                                } 
    590591                                obexftp_closedir(dir); 
  • trunk/obexftp/cache.c

    r186 r191  
    110110                        if (node->content) \ 
    111111                                free(node->content); \ 
     112                        if (node->stats) \ 
     113                                free(node->stats); \ 
    112114                        free(node); \ 
    113115                        } while(0) 
     
    247249        Very limited - not multi-byte character save. 
    248250        It's actually "const char *xml" but can't be declared as such. 
     251        \return a new allocated array of stat_entry_t's. 
    249252 */ 
    250253static stat_entry_t *parse_directory(char *xml) 
     
    274277        ni = strlen(xml); 
    275278        no = ni; 
    276         xml_latin1 = xml_end = malloc(no); 
     279        xml_latin1 = xml_end = malloc(no+1); 
    277280        p = xml; 
    278281        if (xml_latin1) { 
     
    429432                *p++ = '\0'; 
    430433                basename = p; 
    431         } else 
     434        } else { 
     435                *path = '\0'; 
    432436                basename = name; 
     437        } 
    433438        DEBUG(2, "%s() stating '%s' / '%s'\n", __func__, path, basename); 
    434439 
     
    448453                cache->stats = parse_directory(cache->content); 
    449454        DEBUG(2, "%s() got dir '%s'\n", __func__, path); 
     455        free(path); 
    450456         
    451457        /* then lookup the basename */ 
  • trunk/obexftp/client.c

    r186 r191  
    573573 
    574574        OBEX_Cleanup(cli->obexhandle); 
     575        if (cli->buf_data) { 
     576                DEBUG(1, "%s: Warning: purging left-over buffer.\n", __func__); 
     577                free(cli->buf_data); 
     578        } 
     579        cache_purge(&cli->cache, NULL); 
    575580        free(cli->stream_chunk); 
    576581        free(cli);