String alloc shouldn't convert to std::string
.
Some checks failed
CI / ubuntu-latest-html-tests (push) Has been cancelled
CI / alpine-mbedtls-3_6_0 (push) Has been cancelled
CI / ubuntu-latest-no-tls (push) Has been cancelled
CI / ubuntu-latest-mbedtls2 (push) Has been cancelled
CI / ubuntu-latest-openssl-3 (push) Has been cancelled
CI / ubuntu-latest-with-old-std (push) Has been cancelled
CI / ubuntu-20-04-openssl-1-1 (push) Has been cancelled
CI / macOS-13-openssl-1-1 (push) Has been cancelled
CI / macOS-13-openssl-3 (push) Has been cancelled
CI / freebsd-14-openssl-3 (push) Has been cancelled
CI / windows-mbedtls (push) Has been cancelled
Some checks failed
CI / ubuntu-latest-html-tests (push) Has been cancelled
CI / alpine-mbedtls-3_6_0 (push) Has been cancelled
CI / ubuntu-latest-no-tls (push) Has been cancelled
CI / ubuntu-latest-mbedtls2 (push) Has been cancelled
CI / ubuntu-latest-openssl-3 (push) Has been cancelled
CI / ubuntu-latest-with-old-std (push) Has been cancelled
CI / ubuntu-20-04-openssl-1-1 (push) Has been cancelled
CI / macOS-13-openssl-1-1 (push) Has been cancelled
CI / macOS-13-openssl-3 (push) Has been cancelled
CI / freebsd-14-openssl-3 (push) Has been cancelled
CI / windows-mbedtls (push) Has been cancelled
As I work through making code use more C++ RAII and such, most of the work is handling strings, especially temporaries. As member variables which manage string memory get turned into `std::string`, some use cases might wind up leaking memory. (One was found in this change.) By using a non-convertible-to-string result, such accidents should be avoided.
This commit is contained in:
@ -866,9 +866,9 @@ FltkEntryResource::FltkEntryResource (FltkPlatform *platform, int size,
|
||||
{
|
||||
this->size = size;
|
||||
this->password = password;
|
||||
this->label = label ? dStrdup(label) : NULL;
|
||||
this->label = dStrdup(label);
|
||||
this->label_w = 0;
|
||||
this->placeholder = placeholder ? dStrdup(placeholder) : NULL;
|
||||
this->placeholder = dStrdup(placeholder);
|
||||
|
||||
initText = NULL;
|
||||
editable = false;
|
||||
@ -1052,7 +1052,7 @@ FltkMultiLineTextResource::FltkMultiLineTextResource (FltkPlatform *platform,
|
||||
MSG_WARN("numRows = %d is set to 1.\n", numRows);
|
||||
numRows = 1;
|
||||
}
|
||||
this->placeholder = placeholder ? dStrdup(placeholder) : NULL;
|
||||
this->placeholder = dStrdup(placeholder);
|
||||
|
||||
init (platform);
|
||||
}
|
||||
|
@ -371,7 +371,7 @@ TrieBuilder::~TrieBuilder ()
|
||||
void TrieBuilder::insert (const char *key, const char *value)
|
||||
{
|
||||
dataList->increase ();
|
||||
dataList->getLastRef ()->key = (unsigned char *) dStrdup(key);
|
||||
dataList->getLastRef ()->key = (unsigned char *) dStrdup(key).ptr;
|
||||
dataList->getLastRef ()->value = dataZone->strdup (value);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user