lib/list.c: realloc(3) and memmove(3) to prevent memory leaks - #1423
Draft
alejandro-colomar wants to merge 6 commits into
Draft
lib/list.c: realloc(3) and memmove(3) to prevent memory leaks#1423alejandro-colomar wants to merge 6 commits into
alejandro-colomar wants to merge 6 commits into
Conversation
alejandro-colomar
force-pushed
the
leakls
branch
2 times, most recently
from
December 14, 2025 13:03
550cffb to
378deaa
Compare
alejandro-colomar
force-pushed
the
leakls
branch
from
December 14, 2025 13:33
378deaa to
55b3d70
Compare
alejandro-colomar
force-pushed
the
leakls
branch
9 times, most recently
from
December 14, 2025 14:40
c6a7a19 to
ee48f1a
Compare
alejandro-colomar
marked this pull request as draft
December 14, 2025 14:51
alejandro-colomar
force-pushed
the
leakls
branch
from
December 14, 2025 15:11
ee48f1a to
0d2aceb
Compare
alejandro-colomar
marked this pull request as ready for review
December 14, 2025 15:20
alejandro-colomar
force-pushed
the
leakls
branch
3 times, most recently
from
December 15, 2025 00:42
c21af3c to
8c95007
Compare
alejandro-colomar
force-pushed
the
leakls
branch
from
December 23, 2025 22:00
8c95007 to
5e4650e
Compare
alejandro-colomar
force-pushed
the
leakls
branch
from
December 31, 2025 02:27
5e4650e to
7637356
Compare
alejandro-colomar
force-pushed
the
leakls
branch
2 times, most recently
from
February 25, 2026 14:55
d835be3 to
a0a653d
Compare
alejandro-colomar
force-pushed
the
leakls
branch
from
March 4, 2026 17:10
a0a653d to
b4acf53
Compare
alejandro-colomar
force-pushed
the
leakls
branch
from
April 12, 2026 08:17
b4acf53 to
dbffce9
Compare
alejandro-colomar
force-pushed
the
leakls
branch
4 times, most recently
from
April 12, 2026 10:07
7920b52 to
1f0428e
Compare
alejandro-colomar
force-pushed
the
leakls
branch
2 times, most recently
from
July 20, 2026 13:02
3eadbd1 to
d8cfb82
Compare
alejandro-colomar
force-pushed
the
leakls
branch
from
August 19, 2026 09:26
d8cfb82 to
1e3cbc1
Compare
alejandro-colomar
force-pushed
the
leakls
branch
from
August 24, 2026 12:10
1e3cbc1 to
756e6e1
Compare
An interesting detail is that we require the second argument to be non-const, while the memmove(3) function gets a const void*. This is because the second argument should usually be just the same as the first one, plus some offset, and thus will have the same const qualification (that is, it will not be qualified). Don't return anything, as we're not using the return value. That avoids having to use a cast (we can't use a compound literal because of -Werror=unused-value). Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This adds type safety. Signed-off-by: Alejandro Colomar <alx@kernel.org>
alejandro-colomar
force-pushed
the
leakls
branch
from
August 25, 2026 15:34
756e6e1 to
2d3cad5
Compare
alejandro-colomar
marked this pull request as draft
August 25, 2026 15:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cc: @uecker
Revisions:
v2
v2b
v3
v3b
interdiff
range-diff
v3c
interdiff
range-diff
v3d
interdiff
range-diff
v4
v4b
v5
interdiff
range-diff
v6
v7
v8
v9
const-qualified input.v10
v10b
v10c
v10d
v10e
v11
v11b
v11c
v12
v13
v13b
\from v13.v13c
v13d
v13e
v13f
v14
v15