[parted-devel] [PATCH 86/86] parted.c: Make sure dev_name is freed
Phillip Susi
psusi at ubuntu.com
Tue Jul 24 14:45:32 BST 2018
On 7/23/2018 8:26 PM, Brian C. Lane wrote:
> If there was a problem with ped_device_get or ped_device_open it would not be freed.
Looks good, but while looking at this I think I spotted another bug. It
looks like this path calls ped_device_probe_all() to find all devices on
the system, then ped_device_free_all() to get rid of them ( why even
bother? to save a few bytes of heap? or are they holding open file
handles that we want to close? ). Then it tries to re-acquire the
device that it already had when this started. In the process of doing
this though, it will discard any unsaved changes that are represented in
the previously existing PedDisk that have not been saved to disk yet.
I think it may need to instead loop over the devices closing them all,
except for the originally open one, rather than call
ped_device_free_all(). That also gets rid of the need to strdup the
name and the rest of the changes in this patch.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://alioth-lists.debian.net/pipermail/parted-devel/attachments/20180724/6d25441a/attachment.sig>
More information about the parted-devel
mailing list