nv50/ir: Free target if we failed to create a program
authorPierre Moreau <pierre.morrow@free.fr>
Sat, 6 May 2017 21:47:21 +0000 (23:47 +0200)
committerIlia Mirkin <imirkin@alum.mit.edu>
Sun, 7 May 2017 14:26:36 +0000 (10:26 -0400)
Signed-off-by: Pierre Moreau <pierre.morrow@free.fr>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/drivers/nouveau/codegen/nv50_ir.cpp

index 1f640a348a54840aea3c0c182a953bbc56c8ffd2..a4b46eb13f15ce97fb7f92318fe698e50bc0994d 100644 (file)
@@ -1224,8 +1224,10 @@ nv50_ir_generate_code(struct nv50_ir_prog_info *info)
       return -1;
 
    nv50_ir::Program *prog = new nv50_ir::Program(type, targ);
-   if (!prog)
+   if (!prog) {
+      nv50_ir::Target::destroy(targ);
       return -1;
+   }
    prog->driver = info;
    prog->dbgFlags = info->dbgFlags;
    prog->optLevel = info->optLevel;