Skip to content

Commit

Permalink
fix the memory leak of numa_preferred api
Browse files Browse the repository at this point in the history
  • Loading branch information
luochenglcs authored and andikleen committed Sep 23, 2022
1 parent 834dc76 commit 04da3af
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion libnuma.c
Original file line number Diff line number Diff line change
Expand Up @@ -1828,7 +1828,14 @@ static struct bitmask *__numa_preferred(void)

int numa_preferred(void)
{
return numa_find_first(__numa_preferred());
int first_node = 0;
struct bitmask *bmp;

bmp = __numa_preferred();
first_node = numa_find_first(bmp);
numa_bitmask_free(bmp);

return first_node;
}

static void __numa_set_preferred(struct bitmask *bmp)
Expand Down

0 comments on commit 04da3af

Please sign in to comment.