Skip to content

Commit

Permalink
Fixing empty string return and segfault on finish!
Browse files Browse the repository at this point in the history
  • Loading branch information
antony-jr committed Jan 13, 2018
1 parent 21a57c3 commit e854b47
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions AIUpdaterBridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,18 @@ void AIUpdaterBridge::doUpdate(void)
}

if(stopUpdate) {
appImage.clear();
zsyncHeader.clear();
zsyncFileName.clear();
zsyncHeaderJson = QJsonObject(); // clean zsync header
zsyncURL.clear();
fileURL.clear();

if(zsyncFile != NULL){
free(zsyncFile);
zsyncFile = NULL;
}
github = stopUpdate = false;
mutex.unlock();
emit(stopped());
return;
Expand Down Expand Up @@ -884,7 +896,26 @@ void AIUpdaterBridge::doUpdate(void)
emit error(LocalFile, POST_INSTALLATION_FAILED);
return;
}

/*
* Clear everything -> This is really important!
*/
zsyncHeader.clear();
zsyncFileName.clear();
zsyncHeaderJson = QJsonObject(); // clean zsync header
zsyncURL.clear();
fileURL.clear();

if(zsyncFile != NULL){
/*
* Do not free here!
*/
zsyncFile = NULL;
}
github = stopUpdate = false;

emit updateFinished(appImage, RemoteSHA1); // Yeaa , Finally Finished Gracefully!
appImage.clear();
}
mutex.unlock();
return;
Expand Down

0 comments on commit e854b47

Please sign in to comment.