mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 08:25:40 +02:00
Fix more (small) memory leaks
This commit is contained in:
@@ -84,8 +84,12 @@ struct pool_val *pool_long_long(struct pool *p, long long *s, int type) {
|
||||
return pool1(p, (char *) s, type, llcmp);
|
||||
}
|
||||
|
||||
void pool_free(struct pool *p) {
|
||||
void pool_free1(struct pool *p, void (*func)(void *)) {
|
||||
while (p->head != NULL) {
|
||||
if (func != NULL) {
|
||||
func(p->head->s);
|
||||
}
|
||||
|
||||
struct pool_val *next = p->head->next;
|
||||
free(p->head);
|
||||
p->head = next;
|
||||
@@ -96,6 +100,14 @@ void pool_free(struct pool *p) {
|
||||
p->vals = NULL;
|
||||
}
|
||||
|
||||
void pool_free(struct pool *p) {
|
||||
pool_free1(p, NULL);
|
||||
}
|
||||
|
||||
void pool_free_strings(struct pool *p) {
|
||||
pool_free1(p, free);
|
||||
}
|
||||
|
||||
void pool_init(struct pool *p, int n) {
|
||||
p->n = n;
|
||||
p->vals = NULL;
|
||||
|
||||
Reference in New Issue
Block a user