Fix for potential memory leak in the bson_array.c file (#55)

* bson_array_from_bytes_len func update

deinitialize unused var

* bson_object update

Condition update in bson_object_from_bytes_len
This commit is contained in:
Frank Elias 2021-06-04 17:20:22 -04:00 committed by GitHub
parent 732dbf7d55
commit 9234b94c8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -288,7 +288,7 @@ size_t bson_array_from_bytes_len(BsonArray *output, const uint8_t *data, size_t
}
}
if (parseError) {
if (parseError || dataSize - remainBytes == 0) {
bson_array_deinitialize(&array);
return 0;
}

View File

@ -309,7 +309,7 @@ size_t bson_object_from_bytes_len(BsonObject *output, const uint8_t *data, size_
}
}
if (parseError) {
if (parseError || dataSize - remainBytes == 0) {
bson_object_deinitialize(&obj);
return 0;
}