RyanSkraba commented on code in PR #3732:
URL: https://github.com/apache/avro/pull/3732#discussion_r3203676401


##########
lang/c/src/encoding_binary.c:
##########
@@ -136,8 +136,8 @@ static int read_bytes(avro_reader_t reader, char **bytes, 
int64_t * len)
                avro_set_error("Cannot allocate buffer for bytes value");
                return ENOMEM;
        }
-       AVRO_READ(reader, *bytes, *len);
        (*bytes)[*len] = '\0';
+       AVRO_READ_OR_FREE(reader, *bytes, *len);

Review Comment:
   Thanks for this fix! I'm not a C expert, so I wanted to clarify the intended 
behaviour here. When `read_bytes()` (or `read_string()`) returns an error, what 
should callers expect to find in the `*bytes` or `*s` pointer? Will it be 
`NULL` because of macro expansion or not?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to