Changeset 4649 for pjproject


Ignore:
Timestamp:
Nov 7, 2013 8:20:30 AM (11 years ago)
Author:
nanang
Message:

Fix #1710: Modified resolver to always remove cache entry from cache hash table first before releasing/resetting cache pool.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib-util/src/pjlib-util/resolver.c

    r4553 r4649  
    11981198        cache = (struct cached_res *) pj_hash_get(resolver->hrescache, key,  
    11991199                                                  sizeof(*key), &hval); 
     1200        /* Remove the entry before releasing its pool (see ticket #1710) */ 
     1201        pj_hash_set(NULL, resolver->hrescache, key, sizeof(*key), hval, NULL); 
     1202         
     1203        /* Free the entry */ 
    12001204        if (cache && --cache->ref_cnt <= 0) 
    12011205            free_entry(resolver, cache); 
    1202         pj_hash_set(NULL, resolver->hrescache, key, sizeof(*key), hval, NULL); 
    12031206    } 
    12041207 
     
    12341237        cache = (struct cached_res *) pj_hash_get(resolver->hrescache, key,  
    12351238                                                  sizeof(*key), &hval); 
     1239        /* Remove the entry before releasing its pool (see ticket #1710) */ 
     1240        pj_hash_set(NULL, resolver->hrescache, key, sizeof(*key), hval, NULL); 
     1241 
     1242        /* Free the entry */ 
    12361243        if (cache && --cache->ref_cnt <= 0) 
    12371244            free_entry(resolver, cache); 
    1238         pj_hash_set(NULL, resolver->hrescache, key, sizeof(*key), hval, NULL); 
    12391245        return; 
    12401246    } 
     
    12531259        cache = alloc_entry(resolver); 
    12541260    } else { 
     1261        /* Remove the entry before resetting its pool (see ticket #1710) */ 
     1262        pj_hash_set(NULL, resolver->hrescache, key, sizeof(*key), hval, NULL); 
     1263 
    12551264        /* Reset cache to avoid bloated cache pool */ 
    12561265        reset_entry(&cache); 
Note: See TracChangeset for help on using the changeset viewer.