From: Daniel Trnka Date: Thu, 12 Mar 2020 11:08:35 +0000 (+0100) Subject: asix-sigma: move DRAM line buffer allocation closer to its use X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=440810958cc56f9202f5696c92ab15470cdfa94b;p=libsigrok.git asix-sigma: move DRAM line buffer allocation closer to its use Move the allocation of the DRAM line buffer in the sample download code path closer to the location where that buffer is used and gets released. --- diff --git a/src/hardware/asix-sigma/protocol.c b/src/hardware/asix-sigma/protocol.c index a9c16956..268c13cc 100644 --- a/src/hardware/asix-sigma/protocol.c +++ b/src/hardware/asix-sigma/protocol.c @@ -1004,10 +1004,6 @@ static int download_capture(struct sr_dev_inst *sdi) devc = sdi->priv; dl_events_in_line = 64 * 7; - dram_line = g_try_malloc0(chunks_per_read * sizeof(*dram_line)); - if (!dram_line) - return FALSE; - sr_info("Downloading sample data."); devc->state.state = SIGMA_DOWNLOAD; @@ -1063,6 +1059,9 @@ static int download_capture(struct sr_dev_inst *sdi) } else { dl_first_line = 0; } + dram_line = g_try_malloc0(chunks_per_read * sizeof(*dram_line)); + if (!dram_line) + return FALSE; dl_lines_done = 0; while (dl_lines_total > dl_lines_done) { /* We can download only up-to 32 DRAM lines in one go! */