diff options
author | Bjørn Mork <bjorn@mork.no> | 2022-09-16 12:43:17 +0200 |
---|---|---|
committer | Bjørn Mork <bjorn@mork.no> | 2022-09-16 12:43:17 +0200 |
commit | aabe834a59a1debd38b159fa967f31fb2b4c2a76 (patch) | |
tree | a076c42959278bc30c0fc2d3f1bc753735757ed2 | |
parent | 61d7a545b8d5ef02b4ea1263b3fb86bcd49a47f7 (diff) |
always drop ref when changing current_listv0.12
Signed-off-by: Bjørn Mork <bjorn@mork.no>
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | obinsectd.c | 6 |
2 files changed, 4 insertions, 4 deletions
@@ -1,4 +1,4 @@ -VERSION := 0.11 +VERSION := 0.12 LDFLAGS=$(shell pkg-config --libs json-c) $(shell pkg-config --libs libmosquitto) CFLAGS=-Wall $(shell pkg-config --cflags json-c) $(shell pkg-config --cflags libmosquitto) -DVERSION='"$(VERSION)"' -DWITH_TLS diff --git a/obinsectd.c b/obinsectd.c index 82094bf..81afdfa 100644 --- a/obinsectd.c +++ b/obinsectd.c @@ -1198,6 +1198,8 @@ static void set_current_list(const char *listname) obiscode[i] = NULL; /* save list pointer */ + if (current_list) + json_object_put(current_list); current_list = json_object_get(list); debug("Current OBIS list set to '%s\n", listname); } @@ -1255,7 +1257,7 @@ static json_object *format_value(const char *key, json_object *val) /* we can drop val now */ json_object_put(val); - + if (ifactor) { if (!unit) return json_object_new_int(ival * ifactor); @@ -2095,8 +2097,6 @@ err: sleep(1); /* give the mosquitto lib some time to flush remaining messages - FIXME: there gotta be a better way? */ free(buf); free(printbuffer); - if (current_list) - json_object_put(current_list); if (cfg) json_object_put(cfg); mosquitto_disconnect(mosq); |