]> sigrok.org Git - libsigrok.git/commitdiff
sr: chronovu-la8: fix segfault on discovery
authorBert Vermeulen <redacted>
Mon, 23 Jul 2012 22:50:02 +0000 (00:50 +0200)
committerBert Vermeulen <redacted>
Mon, 23 Jul 2012 22:53:01 +0000 (00:53 +0200)
If the uninitialized value didn't happen to contain 0, and there
is no Chronovu LA8 connected, the la8_close() causes a segfault
in libftdi.

hardware/chronovu-la8/api.c

index 81466917f67c228e75d76883a5801437af9edf4b..5b82c3ab9d28eb495f46f6e0c6603db879aba37a 100644 (file)
@@ -70,6 +70,7 @@ static int hw_init(const char *devinfo)
        ctx->done = 0;
        ctx->block_counter = 0;
        ctx->divcount = 0; /* 10ns sample period == 100MHz samplerate */
        ctx->done = 0;
        ctx->block_counter = 0;
        ctx->divcount = 0; /* 10ns sample period == 100MHz samplerate */
+       ctx->usb_pid = 0;
 
        /* Allocate memory where we'll store the de-mangled data. */
        if (!(ctx->final_buf = g_try_malloc(SDRAM_SIZE))) {
 
        /* Allocate memory where we'll store the de-mangled data. */
        if (!(ctx->final_buf = g_try_malloc(SDRAM_SIZE))) {