Skip to content

Commit 1f0918b

Browse files
authoredFeb 9, 2021
avro: add additional check returned from flb_malloc (#3045)
This PR tries to address the issue raised in 3044 where memory pointer returned from flb_malloc was not checked for NULL. Credit to raminfp. This PR fixes the 3044. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
1 parent a15649d commit 1f0918b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed
 

‎src/flb_avro.c

+4
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,10 @@ flb_sds_t flb_msgpack_raw_to_avro_sds(const void *in_buf, size_t in_size, struct
269269

270270
size_t avro_buffer_size = in_size * 3;
271271
char *out_buff = flb_malloc(avro_buffer_size);
272+
if (!out_buff) {
273+
flb_errno();
274+
return NULL;
275+
}
272276

273277
avro_writer_t awriter;
274278
flb_debug("in flb_msgpack_raw_to_avro_sds\n");

0 commit comments

Comments
 (0)
Please sign in to comment.