Changeset 192 for trunk

Show
Ignore:
Timestamp:
09/03/07 21:47:42 (15 months ago)
Author:
zany
Message:

fixing cache root dups

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/obexftp/cache.c

    r191 r192  
    6262        char *copy, *p; 
    6363 
    64         return_val_if_fail(name != NULL, strdup("")); 
     64        if (!name) name = ""; 
    6565 
    6666        p = copy = malloc(strlen(name) + 2); /* at most add two slashes */ 
     
    445445        for (cache = cli->cache; cache && strcmp(cache->name, abs); cache = cache->next); 
    446446        free(abs); 
    447         if (!cache) 
    448                 return NULL; 
     447        if (!cache) { 
     448                free(path); 
     449                return NULL; 
     450        } 
    449451        DEBUG(2, "%s() found '%s'\n", __func__, cache->name); 
    450452                  
     
    453455                cache->stats = parse_directory(cache->content); 
    454456        DEBUG(2, "%s() got dir '%s'\n", __func__, path); 
    455         free(path); 
    456457         
    457458        /* then lookup the basename */ 
    458459        for (entry = cache->stats; entry && *entry->name && strcmp(entry->name, basename); entry++); 
     460        free(path); 
    459461        if (!entry || !(*entry->name)) 
    460462                return NULL;