Fix leaked nodes in stack
This commit is contained in:
parent
ca6dfb81d9
commit
5f27550a7a
3 changed files with 129 additions and 57 deletions
|
|
@ -8,6 +8,7 @@ extern "C" {
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <stdbool.h>
|
||||
#include "runtime/alloc.h"
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -37,7 +38,10 @@ static inline bool vector_valid(Vector *self) {
|
|||
}
|
||||
|
||||
static inline void vector_delete(Vector *self) {
|
||||
ts_free(self->contents);
|
||||
if (self->contents) {
|
||||
ts_free(self->contents);
|
||||
self->contents = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void *vector_get(Vector *self, size_t index) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue