Skip to content

Commit

Permalink
ldpd: Stop and free synchronous Zebra client on destroy
Browse files Browse the repository at this point in the history
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
  • Loading branch information
ton31337 committed Jun 27, 2023
1 parent 93ffc5a commit a5c9e19
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ldpd/lde.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ static struct list *label_chunk_list;
static struct listnode *current_label_chunk;

/* Synchronous zclient to request labels */
static struct zclient *zclient_sync;
struct zclient *zclient_sync;

/* SIGINT / SIGTERM handler. */
static void
Expand Down
7 changes: 7 additions & 0 deletions ldpd/ldp_zebra.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ static int ldp_zebra_opaque_msg_handler(ZAPI_CALLBACK_ARGS);
static void ldp_sync_zebra_init(void);

static struct zclient *zclient;
extern struct zclient *zclient_sync;
static bool zebra_registered = false;

static void
Expand Down Expand Up @@ -703,4 +704,10 @@ ldp_zebra_destroy(void)
zclient_stop(zclient);
zclient_free(zclient);
zclient = NULL;

if (zclient_sync == NULL)
return;
zclient_stop(zclient_sync);
zclient_free(zclient_sync);
zclient_sync = NULL;
}

0 comments on commit a5c9e19

Please sign in to comment.