summaryrefslogtreecommitdiffstats
path: root/auto_free.h
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2008-06-27 21:45:37 -0400
committerFrank Ch. Eigler <fche@elastic.org>2008-06-27 21:45:37 -0400
commit53ca410a6a6032c2cde6aac6e95b57c68585e48a (patch)
tree79cda31e77dd2fee51b8f2f20e2e76989f4c8ad7 /auto_free.h
parent4494bb1367876f3067d0e7c90b1466b9bd88633f (diff)
parentcfa2ca3cbf2da7bbabcdf35c3085a969bd2370e4 (diff)
downloadsystemtap-steved-53ca410a6a6032c2cde6aac6e95b57c68585e48a.tar.gz
systemtap-steved-53ca410a6a6032c2cde6aac6e95b57c68585e48a.tar.xz
systemtap-steved-53ca410a6a6032c2cde6aac6e95b57c68585e48a.zip
Merge commit 'origin/master' into pr6429-comp-unwindsyms
* commit 'origin/master': Always include libdw using link groups. Fix bug in handling process(PID) probes. Added tests for 'process(PID)' variants. This commit makes changes to the VFS tapset. The changes include deprecation of syscalls2.stp: Add sys_renameat. Only probe lines once for the :* wildcard line pattern. Revert checking address in runtime bz451707: fix conversions.exp test $name Cleanup in tapsets.cxx Added powerpc support to runtime/syscall.h. Remove validating _stext due to many aliased symbols PR6646: Add checking address in runtime Fixed offset argument to vm_callback.
Diffstat (limited to 'auto_free.h')
-rw-r--r--auto_free.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/auto_free.h b/auto_free.h
new file mode 100644
index 00000000..b13e7371
--- /dev/null
+++ b/auto_free.h
@@ -0,0 +1,40 @@
+// -*- C++ -*-
+// Copyright (C) 2008 Red Hat Inc.
+//
+// This file is part of systemtap, and is free software. You can
+// redistribute it and/or modify it under the terms of the GNU General
+// Public License (GPL); either version 2, or (at your option) any
+// later version.
+
+#ifndef AUTO_FREE_H
+#define AUTO_FREE_H 1
+#include <cstdlib>
+
+// Very simple auto_ptr-like class for protecting storage allocated
+// with free().
+class auto_free
+{
+public:
+ auto_free(void* ptr) : _ptr(ptr) {}
+ ~auto_free()
+ {
+ if (_ptr)
+ std::free(_ptr);
+ }
+ void release()
+ {
+ _ptr = 0;
+ }
+private:
+ // No copying allowed.
+ auto_free(const auto_free& af)
+ {
+ }
+ // No assignment either
+ auto_free& operator=(const auto_free& rhs)
+ {
+ return *this;
+ }
+ void* _ptr;
+};
+#endif