On Fri, 8 Dec 2023 18:44:23 +0100 Martin Mareš <mj@xxxxxx> wrote: > > + if (!csv) > > + { > > + printf("Error while saving %s\n", path); > > + free(path); > > + return; > > + } > > We have die(...) for that. I think that die() from common.c is not suitable here, as the utility at that moment in the code still can and must free up resources malloc'ed in the main function. > > + char timestamp[64]; > > + time_t tim = time(NULL); > > + strftime(timestamp, 64, "%FT%H.%M.%S", gmtime(&tim)); > > Please use sizeof(timestamp) to make the code more robust. > > > + char *path = (char *)malloc((strlen(dir) + 128) * sizeof(*path)); > > Please use xmalloc(). > > > + sprintf(path, "%s/lmr_%0*x.%02x.%02x.%x_Rx%X_%s.csv", dir, > > Please avoid plain sprintf() everywhere and use snprintf() instead. > > > + for (uint8_t j = 0; j < recv->lanes_n; j++) > > It's better to use plain integer types ("int" or "unsigned int") for > loop control variables. Everything else will be fixed. Best regards, Nikita Proshkin