We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
With gcc-11 -fanalyzer (GCC 11 Static analysis)
gcc-11 -fanalyzer
jda-nas/udp-queue-natives/udpqueue/udpqueue.c:236:16: warning: leak of ‘bytes’ [CWE-401] [-Wanalyzer-malloc-leak] 236 | return result; | ^~~~~~ ‘manager_queue_packet’: events 1-6 | | 218 | static bool manager_queue_packet(queue_manager_t* manager, uint64_t key, const char* address, int32_t port, void* data, | | ^~~~~~~~~~~~~~~~~~~~ | | | | | (1) entry to ‘manager_queue_packet’ |...... | 221 | uint8_t* bytes = malloc(data_length); | | ~~~~~~~~~~~~~~~~~~~ | | | | | (2) allocated here | 222 | if (bytes == NULL) { | | ~ | | | | | (3) assuming ‘bytes’ is non-NULL | | (4) following ‘false’ branch (when ‘bytes’ is non-NULL)... |...... | 226 | memcpy(bytes, data, data_length); | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (5) ...to here |...... | 229 | bool result = manager_queue_packet_locked(manager, key, address, port, bytes, data_length, explicit_socket); | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (6) calling ‘manager_queue_packet_locked’ from ‘manager_queue_packet’ | +--> ‘manager_queue_packet_locked’: events 7-9 | | 178 | static bool manager_queue_packet_locked(queue_manager_t* manager, uint64_t key, const char* address, int32_t port, | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (7) entry to ‘manager_queue_packet_locked’ |...... | 187 | else if (!existed) { | | ~ | | | | | (8) following ‘false’ branch... |...... | 207 | if (queue->buffer_size >= queue->buffer_capacity) { | | ~~~~~~~~~~~~~~~~~~ | | | | | (9) ...to here | <------+ | ‘manager_queue_packet’: events 10-13 | | 229 | bool result = manager_queue_packet_locked(manager, key, address, port, bytes, data_length, explicit_socket); | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (10) returning to ‘manager_queue_packet’ from ‘manager_queue_packet_locked’ |...... | 232 | if (!result) { | | ~ | | | | | (11) following ‘false’ branch... |...... | 236 | return result; | | ~~~~~~ | | | | | (12) ...to here | | (13) ‘bytes’ leaks here; was allocated at (2) |
The text was updated successfully, but these errors were encountered:
No branches or pull requests
With
gcc-11 -fanalyzer
(GCC 11 Static analysis)The text was updated successfully, but these errors were encountered: