CWE-911: Improper Update of Reference Count (Base)

Description: The product uses a reference count to manage a resource, but it does not update or incorrectly updates the reference count.

Extended Description: Reference counts can be used when tracking how many objects contain a reference to a particular resource, such as in memory management or garbage collection. When the reference count reaches zero, the resource can be de-allocated or reused because there are no more objects that use it. If the reference count accidentally reaches zero, then the resource might be released too soon, even though it is still in use. If all objects no longer use the resource, but the reference count is not zero, then the resource might not ever be released.



Applicable Platforms: ::LANGUAGE NAME:C:LANGUAGE PREVALENCE:Sometimes::LANGUAGE NAME:C++:LANGUAGE PREVALENCE:Sometimes::LANGUAGE CLASS:Not Language-Specific:LANGUAGE PREVALENCE:Undetermined::

Modes of Introduction: ::PHASE:Implementation::






Observed Examples: ::REFERENCE:CVE-2002-0574:DESCRIPTION:chain: reference count is not decremented, leading to memory leak in OS by sending ICMP packets.:LINK:https://www.cve.org/CVERecord?id=CVE-2002-0574::REFERENCE:CVE-2004-0114:DESCRIPTION:Reference count for shared memory not decremented when a function fails, potentially allowing unprivileged users to read kernel memory.:LINK:https://www.cve.org/CVERecord?id=CVE-2004-0114::REFERENCE:CVE-2006-3741:DESCRIPTION:chain: improper reference count tracking leads to file descriptor consumption:LINK:https://www.cve.org/CVERecord?id=CVE-2006-3741::REFERENCE:CVE-2007-1383:DESCRIPTION:chain: integer overflow in reference counter causes the same variable to be destroyed twice.:LINK:https://www.cve.org/CVERecord?id=CVE-2007-1383::REFERENCE:CVE-2007-1700:DESCRIPTION:Incorrect reference count calculation leads to improper object destruction and code execution.:LINK:https://www.cve.org/CVERecord?id=CVE-2007-1700::REFERENCE:CVE-2008-2136:DESCRIPTION:chain: incorrect update of reference count leads to memory leak.:LINK:https://www.cve.org/CVERecord?id=CVE-2008-2136::REFERENCE:CVE-2008-2785:DESCRIPTION:chain/composite: use of incorrect data type for a reference counter allows an overflow of the counter, leading to a free of memory that is still in use.:LINK:https://www.cve.org/CVERecord?id=CVE-2008-2785::REFERENCE:CVE-2008-5410:DESCRIPTION:Improper reference counting leads to failure of cryptographic operations.:LINK:https://www.cve.org/CVERecord?id=CVE-2008-5410::REFERENCE:CVE-2009-1709:DESCRIPTION:chain: improper reference counting in a garbage collection routine leads to use-after-free:LINK:https://www.cve.org/CVERecord?id=CVE-2009-1709::REFERENCE:CVE-2009-3553:DESCRIPTION:chain: reference count not correctly maintained when client disconnects during a large operation, leading to a use-after-free.:LINK:https://www.cve.org/CVERecord?id=CVE-2009-3553::REFERENCE:CVE-2009-3624:DESCRIPTION:Reference count not always incremented, leading to crash or code execution.:LINK:https://www.cve.org/CVERecord?id=CVE-2009-3624::REFERENCE:CVE-2010-0176:DESCRIPTION:improper reference counting leads to expired pointer dereference.:LINK:https://www.cve.org/CVERecord?id=CVE-2010-0176::REFERENCE:CVE-2010-0623:DESCRIPTION:OS kernel increments reference count twice but only decrements once, leading to resource consumption and crash.:LINK:https://www.cve.org/CVERecord?id=CVE-2010-0623::REFERENCE:CVE-2010-2549:DESCRIPTION:OS kernel driver allows code execution:LINK:https://www.cve.org/CVERecord?id=CVE-2010-2549::REFERENCE:CVE-2010-4593:DESCRIPTION:improper reference counting leads to exhaustion of IP addresses:LINK:https://www.cve.org/CVERecord?id=CVE-2010-4593::REFERENCE:CVE-2011-0695:DESCRIPTION:Race condition causes reference counter to be decremented prematurely, leading to the destruction of still-active object and an invalid pointer dereference.:LINK:https://www.cve.org/CVERecord?id=CVE-2011-0695::REFERENCE:CVE-2012-4787:DESCRIPTION:improper reference counting leads to use-after-free:LINK:https://www.cve.org/CVERecord?id=CVE-2012-4787::