free no-longer needed json data

addresses https://github.com/owntracks/recorder/issues/464
This commit is contained in:
Jan-Piet Mens
2024-05-24 21:45:40 +02:00
parent f1fad31a9b
commit 2ebcc4ae6b

4
http.c
View File

@@ -1053,9 +1053,12 @@ static int view(struct mg_connection *conn, const char *viewname)
if ((geoline = geo_linestring(locarray)) != NULL) {
json_delete(obj);
json_delete(locarray);
return (json_response(conn, geoline));
}
json_delete(locarray);
/* Return empty object */
return (json_response(conn, obj));
@@ -1101,6 +1104,7 @@ static int view(struct mg_connection *conn, const char *viewname)
json_append_member(obj, "data", locarray);
json_delete(view);
json_delete(locarray);
return (json_response(conn, obj));
/* NOTREACHED */