From 25d774ebc20fdbf94f1ff047664dc32eaa52b5ba Mon Sep 17 00:00:00 2001 From: Felix Erckenbrecht Date: Fri, 25 Mar 2022 14:25:01 +0100 Subject: Do malloc for fl2k bufs at once, check at once --- src/fl2k_ampliphase.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/fl2k_ampliphase.c b/src/fl2k_ampliphase.c index e532a6c..5e39aa0 100644 --- a/src/fl2k_ampliphase.c +++ b/src/fl2k_ampliphase.c @@ -540,24 +540,16 @@ int main(int argc, char **argv) } /* allocate I buffer */ - buf1 = malloc(FL2K_BUF_LEN); - buf2 = malloc(FL2K_BUF_LEN); - if (!buf1 || !buf2) { - fprintf(stderr, "malloc error!\n"); - exit(1); - } - iambuf = buf1; - itxbuf = buf2; - + iambuf = malloc(FL2K_BUF_LEN); + itxbuf = malloc(FL2K_BUF_LEN); /* allocate Q buffer */ - buf1 = malloc(FL2K_BUF_LEN); - buf2 = malloc(FL2K_BUF_LEN); - if (!buf1 || !buf2) { + qambuf = malloc(FL2K_BUF_LEN); + qtxbuf = malloc(FL2K_BUF_LEN); + + if (!qambuf || !qtxbuf || !iambuf || !itxbuf) { fprintf(stderr, "malloc error!\n"); exit(1); } - qambuf = buf1; - qtxbuf = buf2; /* Baseband buffer */ -- cgit v1.2.3