private void purgeBadVariables() {
		if (!foundBadVariables) {
			return;
		}
		List<Symbol> badSymbols = new ArrayList<>();
		SymbolIterator it = program.getSymbolTable().getChildren(functionSymbol);
		while (it.hasNext()) {
			SymbolDB s = (SymbolDB) it.next();
			if (s instanceof VariableSymbolDB) {
				VariableSymbolDB varSym = (VariableSymbolDB) s;
				if (isBadVariable(varSym)) {
					badSymbols.add(s);
				}
			}
		}
		program.getBookmarkManager()
				.setBookmark(getEntryPoint(), BookmarkType.ERROR, "Bad Variables Removed",
					"Removed " + badSymbols.size() + " bad variables");
		for (Symbol s : badSymbols) {
			s.delete();
		}
		if (hasCustomVariableStorage()) {
			ReturnParameterDB rtnParam = getReturn();
			if (rtnParam.getVariableStorage().isBadStorage()) {
				DataType dt = rtnParam.getDataType();
				VariableStorage storage =
					VoidDataType.isVoidDataType(dt) ? VariableStorage.VOID_STORAGE
							: VariableStorage.UNASSIGNED_STORAGE;
				rtnParam.setStorageAndDataType(storage, dt);
			}
		}
		foundBadVariables = false;
	}
Re-assign dynamic storage for return
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/function/FunctionDB.java