#include <mon_internal.h>
+/* Monitoring response encoder */
+
/* Helper for encoding. Adds a newly allocated JSON object to
* jobj. If the allocation or setting fails, returns NULL after
* cleaning up. */
/* If we have a payload, add it */
if (resp->payload) {
object_set_or_free_and_return(resp_json, jval, "payload", resp->payload);
+ json_incref(resp->payload); /* we just created a second reference to the payload */
}
return resp_json;