Commit 4901435a authored by Denis Kasak's avatar Denis Kasak Committed by Hubert Chathi
Browse files

Improve cleanup in fuzzing harnesses

parent 254a4a56
Pipeline #7415 passed with stages
in 2 minutes and 47 seconds
......@@ -11,4 +11,6 @@ int main(int argc, const char *argv[]) {
decode_message(*reader, message_buffer, message_length, 8);
free(message_buffer);
delete reader;
return EXIT_SUCCESS;
}
......@@ -3,11 +3,10 @@
#include "fuzzing.hh"
int main(int argc, const char *argv[]) {
size_t ignored;
if (argc <= 3) {
const char * message = "Usage: decrypt: <session_key> <session_file>"
" <message_type>\n";
ignored = write(STDERR_FILENO, message, strlen(message));
(void)write(STDERR_FILENO, message, strlen(message));
exit(3);
}
......@@ -59,7 +58,12 @@ int main(int argc, const char *argv[]) {
)
);
ignored = write(STDOUT_FILENO, plaintext, length);
ignored = write(STDOUT_FILENO, "\n", 1);
return ignored;
(void)write(STDOUT_FILENO, plaintext, length);
(void)write(STDOUT_FILENO, "\n", 1);
free(session_buffer);
free(message_buffer);
free(tmp_buffer);
return EXIT_SUCCESS;
}
......@@ -3,10 +3,9 @@
#include "fuzzing.hh"
int main(int argc, const char *argv[]) {
size_t ignored;
if (argc <= 2) {
const char * message = "Usage: decrypt <pickle_key> <group_session>\n";
ignored = write(STDERR_FILENO, message, strlen(message));
(void)write(STDERR_FILENO, message, strlen(message));
exit(3);
}
......@@ -67,7 +66,12 @@ int main(int argc, const char *argv[]) {
)
);
ignored = write(STDOUT_FILENO, plaintext, length);
ignored = write(STDOUT_FILENO, "\n", 1);
return ignored;
(void)write(STDOUT_FILENO, plaintext, length);
(void)write(STDOUT_FILENO, "\n", 1);
free(session_buffer);
free(message_buffer);
free(tmp_buffer);
return EXIT_SUCCESS;
}
......@@ -11,4 +11,6 @@ int main(int argc, const char *argv[]) {
unpickle(pickle_buffer, pickle_buffer + pickle_length, *account);
free(pickle_buffer);
delete account;
return EXIT_SUCCESS;
}
......@@ -11,4 +11,6 @@ int main(int argc, const char *argv[]) {
unpickle(pickle_buffer, pickle_buffer + pickle_length, *session);
free(pickle_buffer);
delete session;
return EXIT_SUCCESS;
}
......@@ -77,13 +77,12 @@ size_t check_error(
) {
if (value == olm_error()) {
const char * olm_message = f(object);
ssize_t ignored;
ignored = write(STDERR_FILENO, message, strlen(message));
ignored = write(STDERR_FILENO, ": ", 2);
ignored = write(STDERR_FILENO, olm_message, strlen(olm_message));
ignored = write(STDERR_FILENO, "\n", 1);
(void)write(STDERR_FILENO, message, strlen(message));
(void)write(STDERR_FILENO, ": ", 2);
(void)write(STDERR_FILENO, olm_message, strlen(olm_message));
(void)write(STDERR_FILENO, "\n", 1);
exit(2);
return ignored;
}
return value;
}
......
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