Calling exit() is going to cause the program to terminate and all of its
resources will get cleaned up by the OS.  There's no real reason why we
need to free anything first.

On Sun, Dec 4, 2016 at 9:47 AM, Nayan Deshmukh <nayan26deshm...@gmail.com>
wrote:

> CovID: 1373563
>
> Signed-off-by: Nayan Deshmukh <nayan26deshm...@gmail.com>
> ---
>  src/intel/tools/aubinator.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c
> index 5e3a684..f64a843 100644
> --- a/src/intel/tools/aubinator.c
> +++ b/src/intel/tools/aubinator.c
> @@ -959,25 +959,28 @@ aub_file_open(const char *filename)
>     fd = open(filename, O_RDONLY);
>     if (fd == -1) {
>        fprintf(stderr, "open %s failed: %s\n", filename, strerror(errno));
> -      exit(EXIT_FAILURE);
> +      goto exit_failure;
>     }
>
>     if (fstat(fd, &sb) == -1) {
>        fprintf(stderr, "stat failed: %s\n", strerror(errno));
> -      exit(EXIT_FAILURE);
> +      goto exit_failure;
>     }
>
>     file->map = mmap(NULL, sb.st_size,
>                      PROT_READ, MAP_SHARED, fd, 0);
>     if (file->map == MAP_FAILED) {
>        fprintf(stderr, "mmap failed: %s\n", strerror(errno));
> -      exit(EXIT_FAILURE);
> +      goto exit_failure;
>     }
>
>     file->cursor = file->map;
>     file->end = file->map + sb.st_size / 4;
>
>     return file;
> +exit_failure:
> +   free(file);
> +   exit(EXIT_FAILURE);
>  }
>
>  static struct aub_file *
> --
> 2.9.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to