nv50: don't leak heap on tls alloc failure
authorIlia Mirkin <imirkin@alum.mit.edu>
Sun, 12 Jan 2014 03:03:19 +0000 (22:03 -0500)
committerMaarten Lankhorst <maarten.lankhorst@canonical.com>
Mon, 27 Jan 2014 15:40:42 +0000 (16:40 +0100)
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/drivers/nouveau/nv50/nv50_program.c

index 73df71c61e2f818f1ba26dfc405cc90ced5a761d..97857d7989f006628c956d00f87e8f27e460ff54 100644 (file)
@@ -405,8 +405,10 @@ nv50_program_upload_code(struct nv50_context *nv50, struct nv50_program *prog)
    prog->code_base = prog->mem->start;
 
    ret = nv50_tls_realloc(nv50->screen, prog->tls_space);
-   if (ret < 0)
+   if (ret < 0) {
+      nouveau_heap_free(&prog->mem);
       return FALSE;
+   }
    if (ret > 0)
       nv50->state.new_tls_space = TRUE;