Skip to content

Commit

Permalink
isisd: Fix SRv6 memory leaks
Browse files Browse the repository at this point in the history
When isis_zebra_process_srv6_locator_chunk() returns prematurely
due to an error, do not forget to free memory allocated by
srv6_locator_chunk_alloc().

Signed-off-by: Carmine Scarpitta <[email protected]>
  • Loading branch information
cscarpitta committed Sep 21, 2023
1 parent 4d64bad commit 46d1028
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions isisd/isis_zebra.c
Original file line number Diff line number Diff line change
Expand Up @@ -1136,13 +1136,17 @@ static int isis_zebra_process_srv6_locator_chunk(ZAPI_CALLBACK_ARGS)
enum srv6_endpoint_behavior_codepoint behavior;
bool allocated = false;

if (!isis)
if (!isis) {
srv6_locator_chunk_free(&chunk);
return -1;
}

/* Decode the received zebra message */
s = zclient->ibuf;
if (zapi_srv6_locator_chunk_decode(s, chunk) < 0)
if (zapi_srv6_locator_chunk_decode(s, chunk) < 0) {
srv6_locator_chunk_free(&chunk);
return -1;
}

sr_debug(
"Received SRv6 locator chunk from zebra: name %s, "
Expand Down

0 comments on commit 46d1028

Please sign in to comment.