Skip to content

Commit

Permalink
fixup! libplugin: if DEVELOPER set, do memleak detection on shutdown.
Browse files Browse the repository at this point in the history
  • Loading branch information
cdecker committed Sep 5, 2021
1 parent a1dafe6 commit 46016b3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion plugins/libplugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,9 @@ handle_getmanifest(struct command *getmanifest_cmd,
struct json_stream *params = jsonrpc_stream_success(getmanifest_cmd);
struct plugin *p = getmanifest_cmd->plugin;
const jsmntok_t *dep;
#if DEVELOPER
bool has_shutdown_notif;
#endif

/* This was added post 0.9.0 */
dep = json_get_member(buf, getmanifest_params, "allow-deprecated-apis");
Expand Down Expand Up @@ -630,13 +632,13 @@ handle_getmanifest(struct command *getmanifest_cmd,
json_array_end(params);

json_array_start(params, "subscriptions");
#if DEVELOPER
has_shutdown_notif = false;
for (size_t i = 0; i < p->num_notif_subs; i++) {
json_add_string(params, NULL, p->notif_subs[i].name);
if (streq(p->notif_subs[i].name, "shutdown"))
has_shutdown_notif = true;
}
#if DEVELOPER
/* For memleak detection, always get notified of shutdown. */
if (!has_shutdown_notif)
json_add_string(params, NULL, "shutdown");
Expand Down

0 comments on commit 46016b3

Please sign in to comment.