mirror of
https://github.com/owntracks/recorder.git
synced 2026-08-23 11:26:16 +00:00
valgrind is happier
This commit is contained in:
+11
-6
@@ -599,7 +599,7 @@ void handle_message(void *userdata, char *topic, char *payload, size_t payloadle
|
||||
char *topics[42];
|
||||
int count = 0, cached;
|
||||
static UT_string *basetopic = NULL, *username = NULL, *device = NULL, *addr = NULL, *cc = NULL, *ghash = NULL, *ts = NULL;
|
||||
static UT_string *reltopic = NULL;
|
||||
static UT_string *reltopic = NULL, *filename = NULL;
|
||||
char *jsonstring, *_typestr = NULL;
|
||||
time_t now;
|
||||
int pingping = FALSE, skipslash = 0;
|
||||
@@ -1027,7 +1027,6 @@ void handle_message(void *userdata, char *topic, char *payload, size_t payloadle
|
||||
json_append_member(json, "ghash", json_mkstring(UB(ghash)));
|
||||
|
||||
if (_type == T_LOCATION || _type == T_WAYPOINT) {
|
||||
UT_string *filename = NULL;
|
||||
char *component;
|
||||
|
||||
utstring_renew(filename);
|
||||
@@ -1165,10 +1164,10 @@ static char *mosquitto_reason(int rc)
|
||||
|
||||
void on_disconnect(struct mosquitto *mosq, void *userdata, int reason)
|
||||
{
|
||||
struct udata *ud = (struct udata *)userdata;
|
||||
// struct udata *ud = (struct udata *)userdata;
|
||||
|
||||
if (reason == 0) { // client wish
|
||||
gcache_close(ud->gc);
|
||||
;
|
||||
} else {
|
||||
olog(LOG_INFO, "Disconnected. Reason: 0x%X [%s]", reason, mosquitto_reason(reason));
|
||||
}
|
||||
@@ -1704,12 +1703,16 @@ int main(int argc, char **argv)
|
||||
|
||||
json_delete(ud->topics);
|
||||
|
||||
if (ud->t2t)
|
||||
gcache_close(ud->t2t);
|
||||
gcache_close(ud->gc);
|
||||
gcache_close(ud->t2t);
|
||||
gcache_close(ud->httpfriends);
|
||||
#ifdef WITH_LUA
|
||||
if (ud->luadb)
|
||||
gcache_close(ud->luadb);
|
||||
#endif
|
||||
# ifdef WITH_ENCRYPT
|
||||
gcache_close(ud->keydb);
|
||||
# endif
|
||||
|
||||
free(ud->label);
|
||||
|
||||
@@ -1721,6 +1724,8 @@ int main(int argc, char **argv)
|
||||
hooks_exit(ud->luadata, "recorder stops");
|
||||
#endif
|
||||
|
||||
revgeo_free();
|
||||
|
||||
#ifdef WITH_MQTT
|
||||
mosquitto_disconnect(mosq);
|
||||
|
||||
|
||||
@@ -472,20 +472,12 @@ static void lsscan(char *pathpat, time_t s_lo, time_t s_hi, JsonNode *obj, int r
|
||||
{
|
||||
struct dirent **namelist;
|
||||
int i, n;
|
||||
JsonNode *jarr;
|
||||
JsonNode *jarr = NULL;
|
||||
static UT_string *path = NULL;
|
||||
|
||||
if (obj == NULL || obj->tag != JSON_OBJECT)
|
||||
return;
|
||||
|
||||
/* If our obj contains the "results" array, use that
|
||||
* and remove from obj; we'll add it back later.
|
||||
*/
|
||||
if ((jarr = json_find_member(obj, "results")) == NULL) {
|
||||
jarr = json_mkarray();
|
||||
} else {
|
||||
json_remove_from_parent(jarr);
|
||||
}
|
||||
|
||||
utstring_renew(path);
|
||||
|
||||
@@ -498,6 +490,15 @@ static void lsscan(char *pathpat, time_t s_lo, time_t s_hi, JsonNode *obj, int r
|
||||
return;
|
||||
}
|
||||
|
||||
/* If our obj contains the "results" array, use that
|
||||
* and remove from obj; we'll add it back later.
|
||||
*/
|
||||
if ((jarr = json_find_member(obj, "results")) == NULL) {
|
||||
jarr = json_mkarray();
|
||||
} else {
|
||||
json_remove_from_parent(jarr);
|
||||
}
|
||||
|
||||
if (reverse) {
|
||||
for (i = n - 1; i >= 0; i--) {
|
||||
utstring_clear(path);
|
||||
@@ -529,7 +530,7 @@ static void lsscan(char *pathpat, time_t s_lo, time_t s_hi, JsonNode *obj, int r
|
||||
JsonNode *lister(char *user, char *device, time_t s_lo, time_t s_hi, int reverse)
|
||||
{
|
||||
JsonNode *json = json_mkobject();
|
||||
UT_string *path = NULL;
|
||||
static UT_string *path = NULL;
|
||||
char *bp;
|
||||
|
||||
utstring_renew(path);
|
||||
@@ -567,7 +568,7 @@ JsonNode *lister(char *user, char *device, time_t s_lo, time_t s_hi, int reverse
|
||||
JsonNode *multilister(JsonNode *udpairs, time_t s_lo, time_t s_hi, int reverse)
|
||||
{
|
||||
JsonNode *json = json_mkobject(), *ud;
|
||||
UT_string *path = NULL;
|
||||
static UT_string *path = NULL;
|
||||
char *pairs[3];
|
||||
int np;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user