Page MenuHomeFreeBSD

Update strsetp(3) EXAMPLE section.
ClosedPublic

Authored by araujo on May 28 2018, 4:24 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, May 3, 7:26 AM
Unknown Object (File)
Fri, May 3, 2:10 AM
Unknown Object (File)
Dec 20 2023, 2:27 AM
Unknown Object (File)
Sep 2 2023, 3:57 PM
Unknown Object (File)
Sep 2 2023, 3:54 PM
Unknown Object (File)
Sep 2 2023, 3:51 PM
Unknown Object (File)
Aug 27 2023, 8:14 PM
Unknown Object (File)
Jun 26 2023, 4:53 PM
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 Not Applicable
Unit
Tests Not Applicable

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

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.