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:
parent
732dbf7d55
commit
9234b94c8e
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue