New defect(s) Reported-by: Coverity Scan
Showing 2 of 2 defect(s)
** CID 1341764: Possible Control flow issues (DEADCODE)
/proxy/http2/HPACK.cc: 347 in encode_string(unsigned char *, const unsigned char *, const char *, unsigned long)()
________________________________________________________________________________________________________
*** CID 1341764: Possible Control flow issues (DEADCODE)
/proxy/http2/HPACK.cc: 347 in encode_string(unsigned char *, const unsigned char *, const char *, unsigned long)()
341 if (use_huffman) {
342 data = static_cast<char *>(ats_malloc(value_len * 4));
343 if (data == NULL)
344 return -1;
345 data_len = huffman_encode(reinterpret_cast<uint8_t *>(data), reinterpret_cast<const uint8_t *>(value), value_len);
346 } else {
CID 1341764: Possible Control flow issues (DEADCODE)
Execution cannot reach this statement: "data = (char *)value;".
347 data = const_cast<char *>(value);
348 data_len = value_len;
349 }
350
351 352 const int64_t len = encode_integer(p, buf_end, data_len, 7);
** CID 1341763: (RESOURCE_LEAK)
/proxy/http2/HPACK.cc: 354 in encode_string(unsigned char *, const unsigned char *, const char *, unsigned long)()
/proxy/http2/HPACK.cc: 360 in encode_string(unsigned char *, const unsigned char *, const char *, unsigned long)()
________________________________________________________________________________________________________
*** CID 1341763: (RESOURCE_LEAK)
/proxy/http2/HPACK.cc: 354 in encode_string(unsigned char *, const unsigned char *, const char *, unsigned long)()
348 data_len = value_len;
349 }
350
351 352 const int64_t len = encode_integer(p, buf_end, data_len, 7);
353 if (len == -1)
CID 1341763: (RESOURCE_LEAK)
Variable "data" going out of scope leaks the storage it points to.
354 return -1;
355 if (use_huffman) {
356 *p |= 0x80;
357 }
358 p += len;
359 if (buf_end < p || buf_end - p < data_len)
/proxy/http2/HPACK.cc: 360 in encode_string(unsigned char *, const unsigned char *, const char *, unsigned long)()
354 return -1;
355 if (use_huffman) {
356 *p |= 0x80;
357 }
358 p += len;
359 if (buf_end < p || buf_end - p < data_len)
CID 1341763: (RESOURCE_LEAK)
Variable "data" going out of scope leaks the storage it points to.
360 return -1;
361
362 363 memcpy(p, data, data_len);
364 p += data_len;
365