Moved deletion of qRestResult outside the if/else in order to prevent leakage.