Fix cppcheck issues in PROTO_AGENT
This commit is contained in:
@@ -83,6 +83,7 @@ int main(int argc, char *argv[])
|
|||||||
pool_buffer_init();
|
pool_buffer_init();
|
||||||
if (proto_agent_start(0, ¶ms) != 0) {
|
if (proto_agent_start(0, ¶ms) != 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[])
|
|||||||
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[])
|
|||||||
pool_buffer_init();
|
pool_buffer_init();
|
||||||
if (proto_agent_start(0, ¶ms) != 0) {
|
if (proto_agent_start(0, ¶ms) != 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[])
|
|||||||
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)
|
|||||||
*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
|
|||||||
*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);
|
||||||
|
|||||||
Reference in New Issue
Block a user