Commit 66d4c4e9 authored by Robert Schmidt's avatar Robert Schmidt

Fix cppcheck issues in PROTO_AGENT

parent 56af9c60
...@@ -83,6 +83,7 @@ int main(int argc, char *argv[]) ...@@ -83,6 +83,7 @@ int main(int argc, char *argv[])
pool_buffer_init(); pool_buffer_init();
if (proto_agent_start(0, &params) != 0) { if (proto_agent_start(0, &params) != 0) {
fprintf(stderr, "error on proto_agent_start()\n"); fprintf(stderr, "error on proto_agent_start()\n");
fclose(f);
return 3; return 3;
} }
atexit(close_proto_agent); atexit(close_proto_agent);
...@@ -102,7 +103,7 @@ int main(int argc, char *argv[]) ...@@ -102,7 +103,7 @@ int main(int argc, char *argv[])
gettimeofday(&t_end, NULL); gettimeofday(&t_end, NULL);
fclose(f); fclose(f);
long us = uelapsed(&t_start, &t_end); 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, totsize, us / 1000, ((float) totsize ) / us,
((float) totsize) / us * 8); ((float) totsize) / us * 8);
fprintf(stderr, "check files using 'diff afile bfile'\n"); fprintf(stderr, "check files using 'diff afile bfile'\n");
......
...@@ -84,6 +84,7 @@ int main(int argc, char *argv[]) ...@@ -84,6 +84,7 @@ int main(int argc, char *argv[])
pool_buffer_init(); pool_buffer_init();
if (proto_agent_start(0, &params) != 0) { if (proto_agent_start(0, &params) != 0) {
fprintf(stderr, "error on proto_agent_start()\n"); fprintf(stderr, "error on proto_agent_start()\n");
fclose(f);
return 3; return 3;
} }
atexit(close_proto_agent); atexit(close_proto_agent);
...@@ -98,7 +99,7 @@ int main(int argc, char *argv[]) ...@@ -98,7 +99,7 @@ int main(int argc, char *argv[])
gettimeofday(&t_end, NULL); gettimeofday(&t_end, NULL);
fclose(f); fclose(f);
long us = uelapsed(&t_start, &t_end); 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, totsize, us / 1000, ((float) totsize ) / us,
((float) totsize) / us * 8); ((float) totsize) / us * 8);
fprintf(stderr, "check files using 'diff afile bfile'\n"); fprintf(stderr, "check files using 'diff afile bfile'\n");
......
...@@ -85,7 +85,7 @@ int f1u_serialize_message(Protocol__F1uMessage *msg, void **buf,int *size) ...@@ -85,7 +85,7 @@ int f1u_serialize_message(Protocol__F1uMessage *msg, void **buf,int *size)
*size = protocol__f1u_message__get_packed_size(msg); *size = protocol__f1u_message__get_packed_size(msg);
*buf = malloc(*size); *buf = malloc(*size);
if (buf == NULL) if (!(*buf))
goto error; goto error;
protocol__f1u_message__pack(msg, *buf); protocol__f1u_message__pack(msg, *buf);
...@@ -181,7 +181,7 @@ int proto_agent_serialize_message(Protocol__FlexsplitMessage *msg, uint8_t **buf ...@@ -181,7 +181,7 @@ int proto_agent_serialize_message(Protocol__FlexsplitMessage *msg, uint8_t **buf
*size = protocol__flexsplit_message__get_packed_size(msg); *size = protocol__flexsplit_message__get_packed_size(msg);
*buf = malloc(*size); *buf = malloc(*size);
if (buf == NULL) if (!(*buf))
goto error; goto error;
protocol__flexsplit_message__pack(msg, *buf); protocol__flexsplit_message__pack(msg, *buf);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment