Home GnuPG

Avoid 'malloc' corner case.
06af687beaa1Unpublished

Unpublished Commit ยท Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.

Description

Avoid 'malloc' corner case.

* src/init.c (_gpgrt_realloc): Avoid calling 'malloc(0)'.

Previously, if '_gpgrt_realloc' was called with both A and N being
zero, malloc is invoked with a size of zero. This happens e.g. when
calling '_gpgrt_free' with a NULL pointer, which is supposed to be a
no-op.

Found using the Clang Static Analyzer.

  • Signed-off-by: Justus Winter <justus@g10code.com>

Details

Provenance
justusAuthored on Nov 19 2015, 11:21 AM
Parents
rEa144fa886384: Add error codes NO_NAME, NO_KEY, and SERVER_FAILURE.
Branches
Unknown
Tags
Unknown

Event Timeline

Justus Winter <justus@g10code.com> committed rE06af687beaa1: Avoid 'malloc' corner case. (authored by Justus Winter <justus@g10code.com>).Nov 19 2015, 11:27 AM