diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2020-02-12 10:54:27 -0600 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2020-02-12 10:54:27 -0600 |
commit | 0e8c19b115797ff934e84c105ef4357a899bc973 (patch) | |
tree | b3645d8bd16c47ab9281b566135472236d6de336 /diskman/partition.cc | |
parent | d72ef990a3a417e4f9062517313afe325e7035e6 (diff) | |
download | horizon-0e8c19b115797ff934e84c105ef4357a899bc973.tar.gz horizon-0e8c19b115797ff934e84c105ef4357a899bc973.tar.bz2 horizon-0e8c19b115797ff934e84c105ef4357a899bc973.tar.xz horizon-0e8c19b115797ff934e84c105ef4357a899bc973.zip |
DiskMan: Fix all memory leaks
Diffstat (limited to 'diskman/partition.cc')
-rw-r--r-- | diskman/partition.cc | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/diskman/partition.cc b/diskman/partition.cc index 308d002..ba94258 100644 --- a/diskman/partition.cc +++ b/diskman/partition.cc @@ -32,13 +32,20 @@ Partition::Partition(Disk &d, void *creation, int type) { } else { this->_size = 0; } - const char *name = fdisk_partname(d.node().c_str(), - fdisk_partition_get_partno(part) + 1); - const char *value; + char *name = fdisk_partname(d.node().c_str(), + fdisk_partition_get_partno(part) + 1); + char *value; value = blkid_get_tag_value(nullptr, "TYPE", name); - if(value != nullptr) this->_fs_type = std::string(value); + if(value != nullptr) { + this->_fs_type = std::string(value); + free(value); + } value = blkid_get_tag_value(nullptr, "LABEL", name); - if(value != nullptr) this->_label = std::string(value); + if(value != nullptr) { + this->_label = std::string(value); + free(value); + } + free(name); break; } case 1: { /* udev */ |