llvm/clang-tools-extra/docs/clang-tidy/checks/readability/delete-null-pointer.rst

.. title:: clang-tidy - readability-delete-null-pointer

readability-delete-null-pointer
===============================

Checks the ``if`` statements where a pointer's existence is checked and then deletes the pointer.
The check is unnecessary as deleting a null pointer has no effect.

.. code:: c++

  int *p;
  if (p)
    delete p;