Don't register the signal handler if LLVM fails
authorMatt Mullins <mmullins@mmlx.us>
Mon, 26 May 2014 02:15:49 +0000 (19:15 -0700)
committerMatt Mullins <mmullins@mmlx.us>
Mon, 26 May 2014 02:21:10 +0000 (19:21 -0700)
If we fail to find an appropriate disassembler, we're just going to segfault
ourselves in the handle_sigsegv() anyway.  Let's not do that.

fuckit.cpp

index c726297..7bc810e 100644 (file)
@@ -72,15 +72,18 @@ static void setup_signals()
                 dontcare);
         if (!target) {
                 fprintf(stderr, "Cannot find target\n");
+                return;
         }
 
         llvm::MCSubtargetInfo* sti = target->createMCSubtargetInfo("", "", "");
         if (!sti) {
                 fprintf(stderr, "Couldn't create subtarget info\n");
+                return;
         }
         disassembler = target->createMCDisassembler(*sti);
         if (!disassembler) {
                 fprintf(stderr, "Couldn't create disassembler\n");
+                return;
         }
 
         fprintf(stderr, "Set up signals\n");