diff --git a/openair2/LAYER2/PROTO_AGENT/cu_test.c b/openair2/LAYER2/PROTO_AGENT/cu_test.c index 2827b9c9a0..78467d68f0 100644 --- a/openair2/LAYER2/PROTO_AGENT/cu_test.c +++ b/openair2/LAYER2/PROTO_AGENT/cu_test.c @@ -83,6 +83,7 @@ int main(int argc, char *argv[]) pool_buffer_init(); if (proto_agent_start(0, ¶ms) != 0) { fprintf(stderr, "error on proto_agent_start()\n"); + fclose(f); return 3; } atexit(close_proto_agent); @@ -102,7 +103,7 @@ int main(int argc, char *argv[]) gettimeofday(&t_end, NULL); fclose(f); long us = uelapsed(&t_start, &t_end); - fprintf(stderr, "read %ld bytes in %ld ms -> %.3fMB/s, %.3fMbps\n", + fprintf(stderr, "read %zu bytes in %ld ms -> %.3fMB/s, %.3fMbps\n", totsize, us / 1000, ((float) totsize ) / us, ((float) totsize) / us * 8); fprintf(stderr, "check files using 'diff afile bfile'\n"); diff --git a/openair2/LAYER2/PROTO_AGENT/du_test.c b/openair2/LAYER2/PROTO_AGENT/du_test.c index 7fa9971f5a..9ff7662ab1 100644 --- a/openair2/LAYER2/PROTO_AGENT/du_test.c +++ b/openair2/LAYER2/PROTO_AGENT/du_test.c @@ -84,6 +84,7 @@ int main(int argc, char *argv[]) pool_buffer_init(); if (proto_agent_start(0, ¶ms) != 0) { fprintf(stderr, "error on proto_agent_start()\n"); + fclose(f); return 3; } atexit(close_proto_agent); @@ -98,7 +99,7 @@ int main(int argc, char *argv[]) gettimeofday(&t_end, NULL); fclose(f); long us = uelapsed(&t_start, &t_end); - fprintf(stderr, "read %ld bytes in %ld ms -> %.3fMB/s, %.3fMbps\n", + fprintf(stderr, "read %zu bytes in %ld ms -> %.3fMB/s, %.3fMbps\n", totsize, us / 1000, ((float) totsize ) / us, ((float) totsize) / us * 8); fprintf(stderr, "check files using 'diff afile bfile'\n"); diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c index 0efeabf7aa..4d3abfdab5 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c @@ -85,7 +85,7 @@ int f1u_serialize_message(Protocol__F1uMessage *msg, void **buf,int *size) *size = protocol__f1u_message__get_packed_size(msg); *buf = malloc(*size); - if (buf == NULL) + if (!(*buf)) goto error; protocol__f1u_message__pack(msg, *buf); @@ -181,7 +181,7 @@ int proto_agent_serialize_message(Protocol__FlexsplitMessage *msg, uint8_t **buf *size = protocol__flexsplit_message__get_packed_size(msg); *buf = malloc(*size); - if (buf == NULL) + if (!(*buf)) goto error; protocol__flexsplit_message__pack(msg, *buf);