owntracks / recorder

Store and access data published by OwnTracks apps
Other
875 stars 122 forks source link

Fix the view lastpos response. #471

Closed patthoyts closed 3 months ago

patthoyts commented 3 months ago

The locarray json data is transferred to the response object and if it is deleted here results in an empty object being returned to the user and the default view just shows "Imported data is malformed" instead of a map. This restores the vmap functionality.

jpmens commented 3 months ago

Merged, thank you!

jpmens commented 3 months ago

I think this might re-open one of the memory leaks we closed in #464

Needs investigation.

patthoyts commented 3 months ago

I'm fairly sure this does not re-introduce a leak. The locarray is attached as the data member of the response object. In the json_response function this object is deleted by json_delete() which iterates over its members and calls delete on each which then deals with the locarray.

I gave valgrind a try and there is no difference between making a single call to get the view lastpos and making 20 such calls.

jpmens commented 3 months ago

Thank you very much for doing that, Pat -- much appreciated, as I won't have to dig out ye olde valgrinde myself. :-)