<div dir="ltr">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.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Dec 4, 2016 at 9:47 AM, Nayan Deshmukh <span dir="ltr"><<a href="mailto:nayan26deshmukh@gmail.com" target="_blank">nayan26deshmukh@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">CovID: 1373563<br>
<br>
Signed-off-by: Nayan Deshmukh <<a href="mailto:nayan26deshmukh@gmail.com">nayan26deshmukh@gmail.com</a>><br>
---<br>
 src/intel/tools/aubinator.c | 9 ++++++---<br>
 1 file changed, 6 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c<br>
index 5e3a684..f64a843 100644<br>
--- a/src/intel/tools/aubinator.c<br>
+++ b/src/intel/tools/aubinator.c<br>
@@ -959,25 +959,28 @@ aub_file_open(const char *filename)<br>
    fd = open(filename, O_RDONLY);<br>
    if (fd == -1) {<br>
       fprintf(stderr, "open %s failed: %s\n", filename, strerror(errno));<br>
-      exit(EXIT_FAILURE);<br>
+      goto exit_failure;<br>
    }<br>
<br>
    if (fstat(fd, &sb) == -1) {<br>
       fprintf(stderr, "stat failed: %s\n", strerror(errno));<br>
-      exit(EXIT_FAILURE);<br>
+      goto exit_failure;<br>
    }<br>
<br>
    file->map = mmap(NULL, sb.st_size,<br>
                     PROT_READ, MAP_SHARED, fd, 0);<br>
    if (file->map == MAP_FAILED) {<br>
       fprintf(stderr, "mmap failed: %s\n", strerror(errno));<br>
-      exit(EXIT_FAILURE);<br>
+      goto exit_failure;<br>
    }<br>
<br>
    file->cursor = file->map;<br>
    file->end = file->map + sb.st_size / 4;<br>
<br>
    return file;<br>
+exit_failure:<br>
+   free(file);<br>
+   exit(EXIT_FAILURE);<br>
 }<br>
<br>
 static struct aub_file *<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.9.3<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div>