Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4ebda34

Browse files
committed
Avoid memory leak on deletion from uint64 list
1 parent0ca96ae commit4ebda34

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

‎hash.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ lappend_uint64(List *list, uint64 datum)
131131
returnlist;
132132
}
133133

134+
/*
135+
* Remove element from a list and free the memory which was allocated to it.
136+
* Looks unconventional, but we unconventionally allocate memory on append, so
137+
* it maybe ok.
138+
*/
134139
List*
135140
ldelete_uint64(List*list,uint64datum)
136141
{
@@ -140,6 +145,7 @@ ldelete_uint64(List *list, uint64 datum)
140145
{
141146
if (*((uint64*)lfirst(cell))==datum)
142147
{
148+
pfree(lfirst(cell));
143149
list=list_delete_ptr(list,lfirst(cell));
144150
returnlist;
145151
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp