Skip to content

buffer::ptr self assignment bug + patch - #44

Merged
liewegas merged 1 commit into
masterfrom
unknown repository
Feb 11, 2013
Merged

liewegas merged 1 commit into
masterfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Feb 10, 2013

Copy link
Copy Markdown

After

buffer::ptr a(1);
a = a;

a call to a.get_raw() will return a null pointer and there will be
no pointer referencing the original buffer::raw object although its
reference count is 1.

buffer::ptr& buffer::ptr::operator= (const ptr& p) is modified to use
a local buffer::raw pointer to fix the memory leak. a = a
is a noop instead of loosing the original raw buffer.

A set of unit tests is added src/test/bufferlist.cc to demonstrate
that the proposed change works as expected. It is checked with
valgrind that reports no memory leak. The same test can be run against
the original code to show that it leaks.

http://tracker.ceph.com/issues/4070 refs #4070

Signed-off-by: Loic Dachary [email protected]

After

buffer::ptr a(1);
a = a;

a call to a.get_raw() will return a null pointer and there will be
no pointer referencing the original buffer::raw object although its
reference count is 1.

buffer::ptr& buffer::ptr::operator= (const ptr& p) is modified to use
a local buffer::raw pointer to fix the memory leak. a = a
is a noop instead of loosing the original raw buffer.

A set of unit tests is added src/test/bufferlist.cc to demonstrate
that the proposed change works as expected. It is checked with
valgrind that reports no memory leak. The same test can be run against
the original code to show that it leaks.

http://tracker.ceph.com/issues/4070 refs #4070

Signed-off-by: Loic Dachary <[email protected]>
liewegas added a commit that referenced this pull request Feb 11, 2013
buffer::ptr self assignment bug + patch

Reviewed-by: Sage Weil <[email protected]>
@liewegas
liewegas merged commit 778c45c into ceph:master Feb 11, 2013
@ghost
ghost deleted the wip-4070 branch February 11, 2013 14:53
XinzeChi pushed a commit to XinzeChi/ceph that referenced this pull request Jan 29, 2016
common: improve shared_cache and simple_cache efficiency
ddiss pushed a commit to ddiss/ceph that referenced this pull request Oct 25, 2016
rgw: remove -EEXIST error msg for ZoneCreate

Reviewed-by: Karol Mroz <[email protected]>
adamemerson added a commit to adamemerson/ceph that referenced this pull request Nov 4, 2017
d1ff03b Merge pull request ceph#44 from adamemerson/wip-system-includes
4cc4b94 build: Mark dependency includes as SYSTEM in dmclock
05096c1 Merge pull request ceph#43 from TaewoongKim/anticipation_conf
f356c45 Add missing anticipation_timeout argument for PullPriorityQueue constructor
9896448 Merge pull request ceph#42 from tchaikov/wip-cmake
979899e add travis CI on gnu/linux
8a3dabd cmake: the built archives are located in ${binary_dir}
ee15ced cmake: check for include in /usr/include also

git-subtree-dir: src/dmclock
git-subtree-split: d1ff03b
ricardoasmarques pushed a commit to ricardoasmarques/ceph that referenced this pull request Jan 31, 2018
mgr/dashboard_v2: Add support for session expire at browser close.
galsalomon66 added a commit that referenced this pull request Jan 14, 2021
votdev referenced this pull request in votdev/ceph Oct 5, 2022
rgw/sfs: Store objects by bucket id.
athanatos pushed a commit to athanatos/ceph that referenced this pull request Feb 14, 2025
build: Mark dependency includes as SYSTEM in dmclock

Reviewed-by: J. Eric Ivancich <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant