Skip to content

Commit

Permalink
libdrgn/tests/language_c: fix drgn_error memory leak
Browse files Browse the repository at this point in the history
We're not destroying the errors we get.

Signed-off-by: Omar Sandoval <osandov@osandov.com>
  • Loading branch information
osandov committed Jun 29, 2024
1 parent f931bfe commit 22b4223
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libdrgn/tests/language_c.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ static const char c_keywords[] =
ck_assert_ptr_nonnull(err);
ck_assert_int_eq(err->code, DRGN_ERROR_SYNTAX);
ck_assert(strstr(err->message, "invalid template arguments"));
drgn_error_destroy(err);
drgn_lexer_deinit(&lexer.lexer);
}
}
Expand All @@ -236,6 +237,7 @@ static const char c_keywords[] =
ck_assert_ptr_nonnull(err);
ck_assert_int_eq(err->code, DRGN_ERROR_SYNTAX);
ck_assert(strstr(err->message, "invalid character"));
drgn_error_destroy(err);
drgn_lexer_deinit(&lexer.lexer);
}
}
Expand Down Expand Up @@ -264,6 +266,7 @@ static const char c_keywords[] =
ck_assert_ptr_nonnull(err);
ck_assert_int_eq(err->code, DRGN_ERROR_SYNTAX);
ck_assert(strstr(err->message, "invalid number"));
drgn_error_destroy(err);
drgn_lexer_deinit(&lexer.lexer);
}
}
Expand All @@ -280,6 +283,7 @@ static const char c_keywords[] =
ck_assert_ptr_nonnull(err);
ck_assert_int_eq(err->code, DRGN_ERROR_SYNTAX);
ck_assert(strstr(err->message, "invalid character"));
drgn_error_destroy(err);
drgn_lexer_deinit(&lexer.lexer);
}
}

0 comments on commit 22b4223

Please sign in to comment.