Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chain free(strzero(s)) #1066

Merged
merged 3 commits into from
Aug 31, 2024
Merged

Conversation

alejandro-colomar
Copy link
Collaborator

@alejandro-colomar alejandro-colomar commented Aug 12, 2024

This reduces repetition of the argument, which could be error-prone.

We need to return the input pointer from memzero() and strzero() for that.


Revisions:

v2
  • Also replace freezero(3bsd) by free(memzero()).
$ git range-diff shadow/master gh/strzero strzero 
1:  4985e362 = 1:  4985e362 lib/: Move memzero.[ch] under lib/string/memset/
2:  b027fb9b = 2:  b027fb9b lib/string/memset/: memzero(), strzero(): Return the pointer
3:  9b295a2d = 3:  9b295a2d lib/: Chain free(strzero(s))
-:  -------- > 4:  6e9f2b7b lib/: Use free(memzero()) instead of freezero(3bsd)
v3
$ git range-diff shadow/master gh/strzero strzero 
1:  4985e362 = 1:  4985e362 lib/: Move memzero.[ch] under lib/string/memset/
2:  b027fb9b = 2:  b027fb9b lib/string/memset/: memzero(), strzero(): Return the pointer
3:  9b295a2d = 3:  9b295a2d lib/: Chain free(strzero(s))
4:  6e9f2b7b < -:  -------- lib/: Use free(memzero()) instead of freezero(3bsd)
v3b
  • Rebase
$ git range-diff master..gh/strzero shadow/master..strzero 
1:  4985e362 = 1:  c049eef9 lib/: Move memzero.[ch] under lib/string/memset/
2:  b027fb9b = 2:  a11b8317 lib/string/memset/: memzero(), strzero(): Return the pointer
3:  9b295a2d = 3:  2dcefb5c lib/: Chain free(strzero(s))

@alejandro-colomar alejandro-colomar changed the title Chain free(strzero(s)) Chain free(strzero(s)) and free(memzero(p, n)), and remove freezero(3bsd) Aug 12, 2024
@hallyn
Copy link
Member

hallyn commented Aug 23, 2024

Can this result in bzero(NULL) being called?

@alejandro-colomar
Copy link
Collaborator Author

Can this result in bzero(NULL) being called?

D'oh! Indeed. Thanks for catching that!

@alejandro-colomar alejandro-colomar changed the title Chain free(strzero(s)) and free(memzero(p, n)), and remove freezero(3bsd) Chain free(strzero(s)) and free(memzero(p, n)) Aug 26, 2024
@alejandro-colomar alejandro-colomar changed the title Chain free(strzero(s)) and free(memzero(p, n)) Chain free(strzero(s)) Aug 26, 2024
This allows chaining with free(3) on the same line.

Signed-off-by: Alejandro Colomar <[email protected]>
This reduces the repetition of the argument, which could be error-prone.

Signed-off-by: Alejandro Colomar <[email protected]>
@hallyn hallyn merged commit f5806e0 into shadow-maint:master Aug 31, 2024
9 checks passed
@alejandro-colomar alejandro-colomar deleted the strzero branch August 31, 2024 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants