mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-05 18:05:42 +02:00
Fix more memory leaks
This commit is contained in:
+5
-2
@@ -404,7 +404,7 @@ again:
|
|||||||
c = j->peek(j);
|
c = j->peek(j);
|
||||||
if (c < '0' || c > '9') {
|
if (c < '0' || c > '9') {
|
||||||
j->error = "Exponent without digits";
|
j->error = "Exponent without digits";
|
||||||
free(val.buf);
|
string_free(&val);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
while (c >= '0' && c <= '9') {
|
while (c >= '0' && c <= '9') {
|
||||||
@@ -468,7 +468,7 @@ again:
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
j->error = "Found backslash followed by unknown character";
|
j->error = "Found backslash followed by unknown character";
|
||||||
free(val.buf);
|
string_free(&val);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -478,8 +478,11 @@ again:
|
|||||||
|
|
||||||
json_object *s = add_object(j, JSON_STRING);
|
json_object *s = add_object(j, JSON_STRING);
|
||||||
if (s != NULL) {
|
if (s != NULL) {
|
||||||
|
val.buf = realloc(val.buf, val.n + 1);
|
||||||
s->string = val.buf;
|
s->string = val.buf;
|
||||||
s->length = val.n;
|
s->length = val.n;
|
||||||
|
} else {
|
||||||
|
string_free(&val);
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user