mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-27 20:58:47 +00:00
downloader: don't leak device name
For Uemis there was string-manipulation that leaked the temporary string. Use QString instead in order not to have to bother about such things. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
dc887f6d0a
commit
a6cfd181e8
1 changed files with 5 additions and 5 deletions
|
@ -14,11 +14,11 @@ void cliDownloader(const char *vendor, const char *product, const char *device)
|
|||
data->setProduct(product);
|
||||
data->setBluetoothMode(false);
|
||||
if (data->vendor() == "Uemis") {
|
||||
char *colon;
|
||||
char *devname = strdup(device);
|
||||
if ((colon = strstr(devname, ":\\ (UEMISSDA)")) != NULL) {
|
||||
*(colon + 2) = '\0';
|
||||
fprintf(stderr, "shortened devname to \"%s\"", devname);
|
||||
QString devname(device);
|
||||
int colon = devname.indexOf(QStringLiteral(":\\ (UEMISSDA)"));
|
||||
if (colon >= 0) {
|
||||
devname.truncate(colon + 2);
|
||||
fprintf(stderr, "shortened devname to \"%s\"", qPrintable(devname));
|
||||
}
|
||||
data->setDevName(devname);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue