fix potential minor memory leak when copying conftrees
This commit is contained in:
parent
f76d235b6d
commit
f51614f415
@ -66,7 +66,7 @@ class ConfSimple {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the object by reading content from a string
|
* Build the object by reading content from a string
|
||||||
* @param data points to the data to parse
|
* @param data points to the data to parse.
|
||||||
* @param readonly if true open readonly, else rw
|
* @param readonly if true open readonly, else rw
|
||||||
* @param tildexp try tilde (home dir) expansion for subsection names
|
* @param tildexp try tilde (home dir) expansion for subsection names
|
||||||
*/
|
*/
|
||||||
@ -127,9 +127,8 @@ class ConfSimple {
|
|||||||
if ((status = rhs.status) == STATUS_ERROR)
|
if ((status = rhs.status) == STATUS_ERROR)
|
||||||
return;
|
return;
|
||||||
filename = rhs.filename;
|
filename = rhs.filename;
|
||||||
if (rhs.data) {
|
// Note: we just share the pointer, this doesnt belong to us
|
||||||
data = new string(*(rhs.data));
|
data = rhs.data;
|
||||||
}
|
|
||||||
submaps = rhs.submaps;
|
submaps = rhs.submaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,12 +137,9 @@ class ConfSimple {
|
|||||||
*/
|
*/
|
||||||
ConfSimple& operator=(const ConfSimple &rhs) {
|
ConfSimple& operator=(const ConfSimple &rhs) {
|
||||||
if (this != &rhs && (status = rhs.status) != STATUS_ERROR) {
|
if (this != &rhs && (status = rhs.status) != STATUS_ERROR) {
|
||||||
delete data;
|
|
||||||
data = 0;
|
|
||||||
filename = rhs.filename;
|
filename = rhs.filename;
|
||||||
if (rhs.data) {
|
// Note: we don't own data. Just share the pointer
|
||||||
data = new string(*(rhs.data));
|
data = rhs.data;
|
||||||
}
|
|
||||||
submaps = rhs.submaps;
|
submaps = rhs.submaps;
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user