[Mesa-dev] [PATCH] Fix possible memory leaks

Daniel Winzen d at winzen4.de
Fri May 1 22:33:48 PDT 2015


Signed-off-by: Daniel Winzen <d at winzen4.de>
---
 src/gallium/state_trackers/xa/xa_tracker.c | 4 +++-
 src/glx/apple/apple_glx_log.c              | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/xa/xa_tracker.c b/src/gallium/state_trackers/xa/xa_tracker.c
index 8901998..5b6c3f9 100644
--- a/src/gallium/state_trackers/xa/xa_tracker.c
+++ b/src/gallium/state_trackers/xa/xa_tracker.c
@@ -151,8 +151,10 @@ xa_tracker_create(int drm_fd)
     (void) loader_fd; /* silence unused var warning */
 #else
     loader_fd = dup(drm_fd);
-    if (loader_fd == -1)
+    if (loader_fd == -1) {
+        free(xa);
         return NULL;
+    }
     if (pipe_loader_drm_probe_fd(&xa->dev, loader_fd, false))
 	xa->screen = pipe_loader_create_screen(xa->dev, PIPE_SEARCH_DIR);
 #endif
diff --git a/src/glx/apple/apple_glx_log.c b/src/glx/apple/apple_glx_log.c
index 5b9a865..a40b678 100644
--- a/src/glx/apple/apple_glx_log.c
+++ b/src/glx/apple/apple_glx_log.c
@@ -96,6 +96,7 @@ void _apple_glx_vlog(int level, const char *file, const char *function,
         fprintf(stderr, "%-9s %24s:%-4d %s(%"PRIu64"): ",
                 _asl_level_string(level), file, line, function, thread);
         vfprintf(stderr, fmt, args2);
+        va_end(args2);
     }
 
     msg = asl_new(ASL_TYPE_MSG);
-- 
2.1.4



More information about the mesa-dev mailing list