On Thu, Feb 9, 2017 at 12:06 AM, 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);

What about error checking (here and later in the patch), or at least
initializing filename to NULL before the call, hoping the
implementation won't touch it on error?
It's not that uncommon to run out of space in 32bit processes, and
it's better to get "obvious" crash than dereferencing uninitialized
pointer later...

GraÅžvydas
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to