Skip to content

Commit

Permalink
downloader: don't leak device name
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
bstoeger authored and atdotde committed Jan 26, 2021
1 parent dc887f6 commit a6cfd18
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cli-downloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit a6cfd18

Please sign in to comment.