On Wed, Feb 8, 2017 at 2:06 PM, Timothy Arceri <tarc...@itsqueeze.com> wrote: > --- > src/util/disk_cache.c | 25 ++++++++++++------------- > 1 file changed, 12 insertions(+), 13 deletions(-) > > diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c > index 7691621..edfff73 100644 > --- a/src/util/disk_cache.c > +++ b/src/util/disk_cache.c > @@ -400,11 +400,12 @@ static char * > get_cache_file(struct disk_cache *cache, cache_key key) > { > char buf[41]; > + char *filename; > > _mesa_sha1_format(buf, key); > + asprintf(&filename, "%s/%c%c/%s", cache->path, buf[0], buf[1], buf + 2); > > - return ralloc_asprintf(cache, "%s/%c%c/%s", > - cache->path, buf[0], buf[1], buf + 2); > + return filename; > } > > /* Create the directory that will be needed for the cache file for \key. > @@ -419,12 +420,10 @@ make_cache_file_directory(struct disk_cache *cache, > cache_key key) > char buf[41]; > > _mesa_sha1_format(buf, key); > - > - dir = ralloc_asprintf(cache, "%s/%c%c", cache->path, buf[0], buf[1]); > - > + asprintf(&dir, "%s/%c%c", cache->path, buf[0], buf[1]); > mkdir_if_needed(dir); > > - ralloc_free(dir); > + free(dir); > } > > /* Given a directory path and predicate function, count all entries in > @@ -625,12 +624,12 @@ disk_cache_remove(struct disk_cache *cache, cache_key > key) > } > > if (stat(filename, &sb) == -1) { > - ralloc_free(filename); > + free(filename); > return; > } > > unlink(filename); > - ralloc_free(filename); > + free(filename); > > if (sb.st_size) > p_atomic_add(cache->size, - sb.st_size); > @@ -655,7 +654,7 @@ disk_cache_put(struct disk_cache *cache, > * final destination filename, (to prevent any readers from seeing > * a partially written file). > */ > - filename_tmp = ralloc_asprintf(cache, "%s.tmp", filename); > + asprintf(&filename_tmp, "%s.tmp", filename); > if (filename_tmp == NULL) > goto done; > > @@ -727,9 +726,9 @@ disk_cache_put(struct disk_cache *cache, > if (fd != -1) > close(fd); > if (filename_tmp) > - ralloc_free(filename_tmp); > + free(filename_tmp); > if (filename) > - ralloc_free(filename); > + free(filename); > } > > void * > @@ -764,7 +763,7 @@ disk_cache_get(struct disk_cache *cache, cache_key key, > size_t *size) > goto fail; > } > > - ralloc_free(filename); > + free(filename); > close(fd); > > if (size) > @@ -776,7 +775,7 @@ disk_cache_get(struct disk_cache *cache, cache_key key, > size_t *size) > if (data) > free(data); > if (filename) > - ralloc_free(filename); > + free(filename); > if (fd != -1) > close(fd); > > -- > 2.9.3 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Reviewed-by: Anuj Phogat <anuj.pho...@gmail.com> _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev