]> sourceware.org Git - lvm2.git/commit
python-lvm: Ensure library handle is correct after python gc() call
authorTony Asleson <tasleson@redhat.com>
Wed, 31 Jul 2013 20:16:01 +0000 (15:16 -0500)
committerTony Asleson <tasleson@redhat.com>
Tue, 19 Nov 2013 20:40:27 +0000 (14:40 -0600)
commit20ffb0f721e72fb25905e9ae77689e901babf4ce
tree1d3cb3019d149b6c64a4d27287647cc36c069bb9
parent1f744733a15fe56404dbd0c4d8e1aab339fef774
python-lvm: Ensure library handle is correct after python gc() call

In a previous commit we added the ability for the library to do garbage
collection, to free all the memory used by the library handle buffer by closing
and re-opening the library handle.  When we introduced this functionality we
also opened up the opportunity that the user of the python bindings to have
an object that references the old library handle.  In this case if the user
tried to use the old object a segmentation fault could occur because the
memory had been previously freed.

This patch tries to mitigate this by storing a copy of the library handle that
was used when the object was created so that it can compare the current in
use pointer with what existed when the object was created.  In the case where
they match the operation is permitted to continue, otherwise an exception is
throw, thus avoiding a segmentation fault.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
python/liblvm.c
This page took 0.037105 seconds and 5 git commands to generate.