From 102067881dd2fc7a5568a5926122f9109eb871f2 Mon Sep 17 00:00:00 2001 From: KubaPro010 Date: Sat, 21 Jun 2025 14:25:39 +0200 Subject: [PATCH] DO NOT USE MALLOC DO NOT USE MALLOC DO NOT USE MALLOC DO NOT USE MALLOC DO NOT USE MALLOC DO NOT USE MALLOC DO NOT USE MALLOC --- io/audio.c | 7 ------- src/fm95.c | 4 ++-- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/io/audio.c b/io/audio.c index 812a625..a2b246c 100644 --- a/io/audio.c +++ b/io/audio.c @@ -29,13 +29,6 @@ int read_PulseInputDevice(PulseInputDevice* dev, void* buffer, size_t size) { return error; } -int read_PulseInputDevicef(PulseInputDevice* dev, void* buffer, size_t size) { - if (!dev->initialized) return -1; - int error = 0; - if(pa_simple_read(dev->dev, buffer, size, &error) == 0) return 0; - return error; -} - void free_PulseInputDevice(PulseInputDevice* dev) { #ifdef PULSE_DEBUG debug_printf("Freeing PulseInputDevice with app_name: %s, stream_name: %s, device: %s\n", dev->app_name, dev->stream_name, dev->device); diff --git a/src/fm95.c b/src/fm95.c index 8bcf0f9..cf26995 100644 --- a/src/fm95.c +++ b/src/fm95.c @@ -370,7 +370,7 @@ int main(int argc, char **argv) { float audio_stereo_input[BUFFER_SIZE*2]; // Stereo float *rds_in = malloc(sizeof(float) * BUFFER_SIZE * rds_streams); - memset(&rds_in, 0, sizeof(rds_in)); + memset(rds_in, 0, sizeof(float) * BUFFER_SIZE * rds_streams); float mpx_in[BUFFER_SIZE] = {0}; float sca_in[BUFFER_SIZE] = {0}; @@ -392,7 +392,7 @@ int main(int argc, char **argv) { } } if(rds_on) { - if((pulse_error = read_PulseInputDevice(&rds_device, rds_in, sizeof(rds_in)))) { + if((pulse_error = read_PulseInputDevice(&rds_device, rds_in, sizeof(float) * BUFFER_SIZE * rds_streams);)) { if(pulse_error == -1) fprintf(stderr, "RDS95 PulseInputDevice reported as uninitialized."); else fprintf(stderr, "Error reading from RDS95 device: %s\n", pa_strerror(pulse_error)); to_run = 0;