Skip to content
OpenAdvisories

Weakness (CWE)

CWE-401: Missing Release of Memory after Effective Lifetime

Variant Draft

The product does not sufficiently track and release allocated memory after it has been used, making the memory unavailable for reallocation and reuse.

How to prevent it (3 mitigations)
  1. Implementation

    Choose a language or tool that provides automatic memory management, or makes manual memory management less error-prone.

    For example, glibc in Linux provides protection against free of invalid pointers.

    When using Xcode to target OS X or iOS, enable automatic reference counting (ARC) [REF-391].

    To help correctly and consistently manage memory when programming in C++, consider using a smart pointer class such as std::auto_ptr (defined by ISO/IEC ISO/IEC 14882:2003), std::shared_ptr and std::unique_ptr (specified by an upcoming revision of the C++ standard, informally referred to as C++ 1x), or equivalent solutions such as Boost.

  2. Architecture and Design

    Use an abstraction library to abstract away risky APIs. Not a complete solution.

  3. Architecture and Design, Build and Compilation

    Consider using the Boehm-Demers-Weiser garbage collector (bdwgc), which can help avoid leaks.

Source: MITRE CWE-401

789 results · Feed

  • Medium 5.5

    wifi: rtlwifi: fix memory leaks and invalid access at probe error path

    In the Linux kernel, the following vulnerability has been resolved: wifi: rtlwifi: fix memory leaks and invalid access at probe error path Deinitialize at reverse order when probe fails. When init_sw_vars fails, rtl_deinit_core should not be called, specially…

  • Medium 5.3

    On affected platforms running Arista EOS with BGP Link State configured, BGP peer flap can cause the BGP agent to leak memory. This may result in BGP routing processing being terminated and route flapping.

    On affected platforms running Arista EOS with BGP Link State configured, BGP peer flap can cause the BGP agent to leak memory. This may result in BGP routing processing being terminated and route flapping.

  • Low 3.3

    Communication Dsoftbus has a memory leak vulnerability

    in OpenHarmony v5.0.2 and prior versions allow a local attacker case DOS through missing release of memory.

  • Medium 4.3

    FFmpeg IAMF File iamf_parse.c audio_element_obu memory leak

    A vulnerability classified as problematic has been found in FFmpeg up to 6e26f57f672b05e7b8b052007a83aef99dc81ccb. This affects the function audio_element_obu of the file libavformat/iamf_parse.c of the component IAMF File Handler. The manipulation of the arg…

  • High 7.5

    net: ethernet: ti: am65-cpsw: fix memleak in certain XDP cases

    In the Linux kernel, the following vulnerability has been resolved: net: ethernet: ti: am65-cpsw: fix memleak in certain XDP cases If the XDP program doesn't result in XDP_PASS then we leak the memory allocated by am65_cpsw_build_skb(). It is pointless to all…

  • Medium 5.5

    iommu: Fix potential memory leak in iopf_queue_remove_device()

    In the Linux kernel, the following vulnerability has been resolved: iommu: Fix potential memory leak in iopf_queue_remove_device() The iopf_queue_remove_device() helper removes a device from the per-iommu iopf queue when PRI is disabled on the device. It resp…

  • Medium 5.5

    ceph: fix memory leak in ceph_mds_auth_match()

    In the Linux kernel, the following vulnerability has been resolved: ceph: fix memory leak in ceph_mds_auth_match() We now free the temporary target path substring allocation on every possible branch, instead of omitting the default branch. In some cases, a me…

  • High 7.5

    Io.quarkus:quarkus-resteasy: memory leak in quarkus resteasy classic when client requests timeout

    A flaw was found in the quarkus-resteasy extension, which causes memory leaks when client requests with low timeouts are made. If a client request times out, a buffer is not released correctly, leading to increased memory usage and eventual application crash …

  • Medium 5.5

    nfc: nfcmrvl: Fix memory leak in nfcmrvl_play_deferred

    In the Linux kernel, the following vulnerability has been resolved: nfc: nfcmrvl: Fix memory leak in nfcmrvl_play_deferred Similar to the handling of play_deferred in commit 19cfe912c37b ("Bluetooth: btusb: Fix memory leak in play_deferred"), we thought a pat…

  • Medium 5.5

    usb: dwc2: Fix memory leak in dwc2_hcd_init

    In the Linux kernel, the following vulnerability has been resolved: usb: dwc2: Fix memory leak in dwc2_hcd_init usb_create_hcd will alloc memory for hcd, and we should call usb_put_hcd to free it when platform_get_resource() fails to prevent memory leak. goto…

  • Medium 5.5

    RDMA/cm: Fix memory leak in ib_cm_insert_listen

    In the Linux kernel, the following vulnerability has been resolved: RDMA/cm: Fix memory leak in ib_cm_insert_listen cm_alloc_id_priv() allocates resource for the cm_id_priv. When cm_init_listen() fails it doesn't free it, leading to memory leak. Add the missi…

  • Medium 5.5

    usbnet: fix memory leak in error case

    In the Linux kernel, the following vulnerability has been resolved: usbnet: fix memory leak in error case usbnet_write_cmd_async() mixed up which buffers need to be freed in which error case. v2: add Fixes tag v3: fix uninitialized buf pointer

  • Medium 5.5

    i2c: piix4: Fix a memory leak in the EFCH MMIO support

    In the Linux kernel, the following vulnerability has been resolved: i2c: piix4: Fix a memory leak in the EFCH MMIO support The recently added support for EFCH MMIO regions introduced a memory leak in that code path. The leak is caused by the fact that release…

  • Medium 5.5

    tracing/histograms: Fix memory leak problem

    In the Linux kernel, the following vulnerability has been resolved: tracing/histograms: Fix memory leak problem This reverts commit 46bbe5c671e06f070428b9be142cc4ee5cedebac. As commit 46bbe5c671e0 ("tracing: fix double free") said, the "double free" problem r…

  • Medium 5.5

    ima: Fix potential memory leak in ima_init_crypto()

    In the Linux kernel, the following vulnerability has been resolved: ima: Fix potential memory leak in ima_init_crypto() On failure to allocate the SHA1 tfm, IMA fails to initialize and exits without freeing the ima_algo_array. Add the missing kfree() for ima_…

  • Medium 5.5

    net: sfp: fix memory leak in sfp_probe()

    In the Linux kernel, the following vulnerability has been resolved: net: sfp: fix memory leak in sfp_probe() sfp_probe() allocates a memory chunk from sfp with sfp_alloc(). When devm_add_action() fails, sfp is not freed, which leads to a memory leak. We shoul…

  • Medium 5.5

    iavf: Fix handling of dummy receive descriptors

    In the Linux kernel, the following vulnerability has been resolved: iavf: Fix handling of dummy receive descriptors Fix memory leak caused by not handling dummy receive descriptor properly. iavf_get_rx_buffer now sets the rx_buffer return value for dummy rece…

  • Medium 5.5

    crypto: qat - fix memory leak in RSA

    In the Linux kernel, the following vulnerability has been resolved: crypto: qat - fix memory leak in RSA When an RSA key represented in form 2 (as defined in PKCS #1 V2.1) is used, some components of the private key persist even after the TFM is released. Rep…

  • Medium 5.5

    drm/amd/pm: fix a potential gpu_metrics_table memory leak

    In the Linux kernel, the following vulnerability has been resolved: drm/amd/pm: fix a potential gpu_metrics_table memory leak Memory is allocated for gpu_metrics_table in renoir_init_smc_tables(), but not freed in int smu_v12_0_fini_smc_tables(). Free it!

  • Medium 5.5

    x86/MCE/AMD: Fix memory leak when threshold_create_bank() fails

    In the Linux kernel, the following vulnerability has been resolved: x86/MCE/AMD: Fix memory leak when threshold_create_bank() fails In mce_threshold_create_device(), if threshold_create_bank() fails, the previously allocated threshold banks array @bp will be …

  • Medium 5.5

    fs/ntfs3: provide block_invalidate_folio to fix memory leak

    In the Linux kernel, the following vulnerability has been resolved: fs/ntfs3: provide block_invalidate_folio to fix memory leak The ntfs3 filesystem lacks the 'invalidate_folio' method and it causes memory leak. If you write to the filesystem and then unmount…

  • Medium 5.5

    scsi: lpfc: Protect memory leak for NPIV ports sending PLOGI_RJT

    In the Linux kernel, the following vulnerability has been resolved: scsi: lpfc: Protect memory leak for NPIV ports sending PLOGI_RJT There is a potential memory leak in lpfc_ignore_els_cmpl() and lpfc_els_rsp_reject() that was allocated from NPIV PLOGI_RJT (l…

  • Medium 5.5

    media: rga: fix possible memory leak in rga_probe

    In the Linux kernel, the following vulnerability has been resolved: media: rga: fix possible memory leak in rga_probe rga->m2m_dev needs to be freed when rga_probe fails.

  • Medium 5.5

    drm: msm: fix possible memory leak in mdp5_crtc_cursor_set()

    In the Linux kernel, the following vulnerability has been resolved: drm: msm: fix possible memory leak in mdp5_crtc_cursor_set() drm_gem_object_lookup will call drm_gem_object_get inside. So cursor_bo needs to be put when msm_gem_get_and_pin_iova fails.

  • Medium 5.5

    thermal/core: Fix memory leak in __thermal_cooling_device_register()

    In the Linux kernel, the following vulnerability has been resolved: thermal/core: Fix memory leak in __thermal_cooling_device_register() I got memory leak as follows when doing fault injection test: unreferenced object 0xffff888010080000 (size 264312): comm "…

  • Medium 5.5

    amt: fix memory leak for advertisement message

    In the Linux kernel, the following vulnerability has been resolved: amt: fix memory leak for advertisement message When a gateway receives an advertisement message, it extracts relay information and then it should be freed. But the advertisement handler doesn…

  • Medium 5.5

    ext4: fix memory leak in parse_apply_sb_mount_options()

    In the Linux kernel, the following vulnerability has been resolved: ext4: fix memory leak in parse_apply_sb_mount_options() If processing the on-disk mount options fails after any memory was allocated in the ext4_fs_context, e.g. s_qf_names, then this memory …

  • Medium 5.5

    lib/string_helpers: fix not adding strarray to device's resource list

    In the Linux kernel, the following vulnerability has been resolved: lib/string_helpers: fix not adding strarray to device's resource list Add allocated strarray to device's resource list. This is a must to automatically release strarray when the device disapp…

  • Medium 5.5

    jffs2: fix memory leak in jffs2_do_fill_super

    In the Linux kernel, the following vulnerability has been resolved: jffs2: fix memory leak in jffs2_do_fill_super If jffs2_iget() or d_make_root() in jffs2_do_fill_super() returns an error, we can observe the following kmemleak report: -----------------------…

  • Medium 5.5

    firmware: dmi-sysfs: Fix memory leak in dmi_sysfs_register_handle

    In the Linux kernel, the following vulnerability has been resolved: firmware: dmi-sysfs: Fix memory leak in dmi_sysfs_register_handle kobject_init_and_add() takes reference even when it fails. According to the doc of kobject_init_and_add() If this function re…

  • Medium 5.5

    amt: fix possible memory leak in amt_rcv()

    In the Linux kernel, the following vulnerability has been resolved: amt: fix possible memory leak in amt_rcv() If an amt receives packets and it finds socket. If it can't find a socket, it should free a received skb. But it doesn't. So, a memory leak would po…

  • Medium 5.5

    netfilter: nf_tables: memleak flow rule from commit path

    In the Linux kernel, the following vulnerability has been resolved: netfilter: nf_tables: memleak flow rule from commit path Abort path release flow rule object, however, commit path does not. Update code to destroy these objects before releasing the transact…

  • Medium 5.5

    mm/huge_memory: Fix xarray node memory leak

    In the Linux kernel, the following vulnerability has been resolved: mm/huge_memory: Fix xarray node memory leak If xas_split_alloc() fails to allocate the necessary nodes to complete the xarray entry split, it sets the xa_state to -ENOMEM, which xas_nomem() t…

  • Medium 5.5

    nfc: st21nfca: fix memory leaks in EVT_TRANSACTION handling

    In the Linux kernel, the following vulnerability has been resolved: nfc: st21nfca: fix memory leaks in EVT_TRANSACTION handling Error paths do not free previously allocated memory. Add devm_kfree() to those failure paths.

  • Medium 5.5

    staging: rtl8712: fix a potential memory leak in r871xu_drv_init()

    In the Linux kernel, the following vulnerability has been resolved: staging: rtl8712: fix a potential memory leak in r871xu_drv_init() In r871xu_drv_init(), if r8712_init_drv_sw() fails, then the memory allocated by r8712_alloc_io_queue() in r8712_usb_dvobj_i…

  • Medium 5.5

    fs/ntfs3: Fix some memory leaks in an error handling path of 'log_replay()'

    In the Linux kernel, the following vulnerability has been resolved: fs/ntfs3: Fix some memory leaks in an error handling path of 'log_replay()' All error handling paths lead to 'out' where many resources are freed. Do it as well here instead of a direct retur…

  • Medium 5.5

    coresight: syscfg: Fix memleak on registration failure in cscfg_create_device

    In the Linux kernel, the following vulnerability has been resolved: coresight: syscfg: Fix memleak on registration failure in cscfg_create_device device_register() calls device_initialize(), according to doc of device_initialize: Use put_device() to give up y…

  • Medium 5.5

    jffs2: fix memory leak in jffs2_do_mount_fs

    In the Linux kernel, the following vulnerability has been resolved: jffs2: fix memory leak in jffs2_do_mount_fs If jffs2_build_filesystem() in jffs2_do_mount_fs() returns an error, we can observe the following kmemleak report: --------------------------------…

  • Medium 5.5

    jffs2: fix memory leak in jffs2_scan_medium

    In the Linux kernel, the following vulnerability has been resolved: jffs2: fix memory leak in jffs2_scan_medium If an error is returned in jffs2_scan_eraseblock() and some memory has been added to the jffs2_summary *s, we can observe the following kmemleak re…

  • Medium 5.5

    drm/amd/display: Call dc_stream_release for remove link enc assignment

    In the Linux kernel, the following vulnerability has been resolved: drm/amd/display: Call dc_stream_release for remove link enc assignment [Why] A porting error resulted in the stream assignment for the link being retained without being released - a memory le…