Skip to content

Commit

Permalink
[Docs] Notes about freeing objects
Browse files Browse the repository at this point in the history
- Free objects returned from PEM read
- Free objects returned from d2i_*

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #24478)
  • Loading branch information
ruslo authored and t8m committed Jun 7, 2024
1 parent 1405401 commit d4700c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion doc/man3/PEM_read_bio_PrivateKey.pod
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,9 @@ NULL but I<*x> is NULL then the structure returned will be written
to I<*x>. If neither I<x> nor I<*x> is NULL then an attempt is made
to reuse the structure at I<*x> (but see BUGS and EXAMPLES sections).
Irrespective of the value of I<x> a pointer to the structure is always
returned (or NULL if an error occurred).
returned (or NULL if an error occurred). The caller retains ownership of the
returned object and needs to free it when it is no longer needed, e.g.
using X509_free() for X509 objects or EVP_PKEY_free() for EVP_PKEY objects.

The PEM functions which write private keys take an I<enc> parameter
which specifies the encryption algorithm to use, encryption is done
Expand Down
4 changes: 3 additions & 1 deletion doc/man3/d2i_X509.pod
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,9 @@ B<d2i_I<TYPE>>() attempts to decode I<len> bytes at I<*ppin>. If successful a
pointer to the B<I<TYPE>> structure is returned and I<*ppin> is incremented to
the byte following the parsed data. If I<a> is not NULL then a pointer
to the returned structure is also written to I<*a>. If an error occurred
then NULL is returned.
then NULL is returned. The caller retains ownership of the
returned object and needs to free it when it is no longer needed, e.g.
using X509_free() for X509 objects or DSA_SIG_free() for DSA_SIG objects.

On a successful return, if I<*a> is not NULL then it is assumed that I<*a>
contains a valid B<I<TYPE>> structure and an attempt is made to reuse it.
Expand Down

0 comments on commit d4700c0

Please sign in to comment.