Skip to content

Ghidra is a software reverse engineering (SRE) framework

Release input address sets after one-shot analysis execution

designonet688ffecba26c
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/OneShotAnalysisCommand.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/OneShotAnalysisCommand.java
index 0efdfff02d..072b018359 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/OneShotAnalysisCommand.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/OneShotAnalysisCommand.java
@@ -26,6 +26,9 @@ import ghidra.util.task.TaskMonitor;
/**
* Background task to artificially kick off Auto analysis by
* calling anything that analyzes bytes.
+ * <p>
+ * This command is single use. Its input address set is released when execution completes or the
+ * queued command is disposed. Completed or disposed commands must not be executed again.
*/
public class OneShotAnalysisCommand extends BackgroundCommand<Program>
implements AutoAnalysisManagerListener {
@@ -52,10 +55,21 @@ public class OneShotAnalysisCommand extends BackgroundCommand<Program>
catch (CancelledException e) {
return false;
}
+ finally {
+ // The manager retains this command as an analysis-ended listener.
+ set = null;
+ }
+ }
+
+ @Override
+ public void dispose() {
+ set = null;
+ super.dispose();
}
@Override
public void analysisEnded(AutoAnalysisManager manager, boolean isCancelled) {
+ manager.removeListener(this);
if (lastProgram != null) {
analyzer.analysisEnded(lastProgram);
}