Fixed ev_vec_pop not always free'ing the popped element
Run tests / Run tests (push) Failing after 9s
Run tests / Run tests (push) Failing after 9s
This commit is contained in:
@@ -643,19 +643,18 @@ ev_vec_pop(
|
||||
|
||||
if(metadata->length == 0) return EV_VEC_ERR_INVALID_OP;
|
||||
|
||||
if(out != NULL) {
|
||||
void *src = ((char *)*v) + ((metadata->length-1) * metadata->typeData.size);
|
||||
if (metadata->typeData.copy_fn) {
|
||||
metadata->typeData.copy_fn(out, src);
|
||||
} else {
|
||||
memcpy(out, src, metadata->typeData.size);
|
||||
}
|
||||
} else {
|
||||
void *elem = ((char *)*v) + ((metadata->length-1) * metadata->typeData.size);
|
||||
if(out != NULL) {
|
||||
if (metadata->typeData.copy_fn) {
|
||||
metadata->typeData.copy_fn(out, elem);
|
||||
} else {
|
||||
memcpy(out, elem, metadata->typeData.size);
|
||||
}
|
||||
}
|
||||
|
||||
if (metadata->typeData.free_fn) {
|
||||
metadata->typeData.free_fn(elem);
|
||||
}
|
||||
}
|
||||
|
||||
metadata->length--;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user