summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2012-08-14 10:26:11 -0700
committerJosé Fonseca <jose.r.fonseca@gmail.com>2012-11-22 08:03:06 +0000
commit42249019f6ac3453c2244bc8aab343a86e48c4d2 (patch)
tree8d6ee201046b733498ef1884a7d2e3e1854547a1 /cli
parentcc6e51c012f447a30072d8e4c3cdd453c361a3c0 (diff)
trim: Close some memory leaks.
The parse_call() function allocates an object and returns a pointer, so we need to explicitly call delete on that object.
Diffstat (limited to 'cli')
-rw-r--r--cli/cli_trim.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/cli/cli_trim.cpp b/cli/cli_trim.cpp
index 69ff4e86..3fc3803c 100644
--- a/cli/cli_trim.cpp
+++ b/cli/cli_trim.cpp
@@ -355,15 +355,20 @@ trim_trace(const char *filename, struct trim_options *options)
/* There's no use doing any work past the last call requested
* by the user. */
- if (call->no > options->calls.getLast())
+ if (call->no > options->calls.getLast()) {
+ delete call;
break;
+ }
/* If requested, ignore all calls not belonging to the specified thread. */
- if (options->thread != -1 && call->thread_id != options->thread)
+ if (options->thread != -1 && call->thread_id != options->thread) {
+ delete call;
continue;
+ }
/* Also, prune if uninteresting (unless the user asked for no pruning. */
if (options->prune_uninteresting && call->flags & trace::CALL_FLAG_UNINTERESTING) {
+ delete call;
continue;
}
@@ -381,6 +386,8 @@ trim_trace(const char *filename, struct trim_options *options)
if (options->dependency_analysis) {
analyzer.analyze(call);
}
+
+ delete call;
}
/* Prepare output file and writer for output. */