@cryptotaxi247 / netdata-1 / commits / d6c7749b8

Coverity fixes (#19484)

* coverity 455577 Use after free * coverity 455576 Unused value - severe bug increasing latency * coverity 454631 Resource leak

Costa Tsaousis committed Jan 25, 2025 at 09:31 UTC d6c7749b83138ebfcb21cc434cf3e3d4fff04961
3 files changed +8 -2
src/aclk/https_client.c
+4
@@ -158,6 +158,9 @@ void http_parse_ctx_create(http_parse_ctx *ctx, enum http_parse_state parse_stat
158
159 void http_parse_ctx_destroy(http_parse_ctx *ctx)
160 {
161 + if(!ctx->headers)
162 + return;
163 +
164 c_rhash_iter_t iter;
165 const char *key;
166
@@ -169,6 +172,7 @@ void http_parse_ctx_destroy(http_parse_ctx *ctx)
172 }
173
174 c_rhash_destroy(ctx->headers);
175 + ctx->headers = NULL;
176 }
177
178 #define POLL_TO_MS 100
src/daemon/pulse/pulse-daemon-memory-system.c
+3 -1
@@ -42,8 +42,10 @@ static bool parse_malloc_info(size_t *arenas, size_t *allocated_arena, size_t *u
42 char *t = malloc(1024);
43
44 // Generate malloc_info XML
45 - if(malloc_info(0, meminfo) != 0)
45 + if(malloc_info(0, meminfo) != 0) {
46 + free(t);
47 goto cleanup;
48 + }
49
50 fflush(meminfo);
51 fclose(meminfo);
src/streaming/stream-receiver.c
+1 -1
@@ -365,7 +365,7 @@ static ssize_t send_to_child(const char *txt, void *data, STREAM_TRAFFIC_TYPE ty
365
366 if(was_empty) {
367 msg.opcode = STREAM_OPCODE_RECEIVER_POLLOUT;
368 - msg.opcode = 0;
368 + msg.reason = 0;
369 }
370 }
371