Page MenuHomeFreeBSD

Update strsetp(3) EXAMPLE section.
ClosedPublic

Authored by araujo on May 28 2018, 4:24 AM.
Tags
None
Referenced Files
F106162538: D15594.id43059.diff
Thu, Dec 26, 10:19 AM
Unknown Object (File)
Sep 25 2024, 10:19 AM
Unknown Object (File)
Sep 24 2024, 3:05 PM
Unknown Object (File)
Sep 20 2024, 2:01 PM
Unknown Object (File)
Sep 19 2024, 11:26 PM
Unknown Object (File)
Sep 17 2024, 3:36 PM
Unknown Object (File)
Aug 30 2024, 11:52 PM
Unknown Object (File)
Aug 22 2024, 5:31 AM
Subscribers

Details

Summary

As many people has pointed out, using assert(3) shall be not the best
approach to verify if strdup(3) has allocated memory to string.

So, I'm updating this manpage example section.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 16875
Build 16752: arc lint + arc unit

Event Timeline

Thanks for doing this...

Others in the tree if you feel inclined, otherwise a bug might be in order so we don't lose it.

/crypto/heimdal/doc/doxyout/krb5/man/man3/krb5_support.3: assert(s == NULL);
./crypto/heimdal/lib/krb5/krb5_acl_match_file.3: assert(s == NULL);
./lib/libc/gen/cap_rights_get.3:assert(memcmp(&setrights, &getrights, sizeof(setrights)) == 0);
./lib/libpmc/pmclog.3: assert(ev.pl_state == PMCLOG_OK);
./lib/libpmc/pmclog.3: assert(0);
./secure/lib/libcrypto/man/EVP_EncryptInit.3:\& OPENSSL_assert(EVP_CIPHER_CTX_key_length(&ctx) == 16);
./secure/lib/libcrypto/man/EVP_EncryptInit.3:\& OPENSSL_assert(EVP_CIPHER_CTX_iv_length(&ctx) == 16);
./secure/lib/libssl/man/d2i_SSL_SESSION.3: assert(i == j);
./secure/lib/libssl/man/d2i_SSL_SESSION.3: assert(p+i == temp);
./share/man/man3/assert.3:.Dl "assert(1 == 0);"

This revision is now accepted and ready to land.May 28 2018, 4:52 AM
In D15594#329304, @imp wrote:

Thanks for doing this...

Others in the tree if you feel inclined, otherwise a bug might be in order so we don't lose it.

/crypto/heimdal/doc/doxyout/krb5/man/man3/krb5_support.3: assert(s == NULL);
./crypto/heimdal/lib/krb5/krb5_acl_match_file.3: assert(s == NULL);
./lib/libc/gen/cap_rights_get.3:assert(memcmp(&setrights, &getrights, sizeof(setrights)) == 0);
./lib/libpmc/pmclog.3: assert(ev.pl_state == PMCLOG_OK);
./lib/libpmc/pmclog.3: assert(0);
./secure/lib/libcrypto/man/EVP_EncryptInit.3:\& OPENSSL_assert(EVP_CIPHER_CTX_key_length(&ctx) == 16);
./secure/lib/libcrypto/man/EVP_EncryptInit.3:\& OPENSSL_assert(EVP_CIPHER_CTX_iv_length(&ctx) == 16);
./secure/lib/libssl/man/d2i_SSL_SESSION.3: assert(i == j);
./secure/lib/libssl/man/d2i_SSL_SESSION.3: assert(p+i == temp);
./share/man/man3/assert.3:.Dl "assert(1 == 0);"

Hi,

Yes, I'm inclined to do this clean up and we all can avoid confusion in the future.

Thanks,

This revision was automatically updated to reflect the committed changes.
head/lib/libc/string/strsep.3
94 ↗(On Diff #43061)

You can't free string. If doesn't point to something allocated by malloc() (unless you'd strdup'd "" in which case it would be a double-free bug.