diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2012-07-18 15:07:28 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2012-07-18 15:07:28 +0930 |
commit | d54ebd36cc95ae13844bd00d5bbb2e3ff1a06285 (patch) | |
tree | 1ac6002dfbf93e1b0dafc414bdfac214047adc1b /source4/torture/ldap/cldap.c | |
parent | 99272331c60afa900852d996196b434ecd897287 (diff) | |
download | samba-d54ebd36cc95ae13844bd00d5bbb2e3ff1a06285.tar.gz samba-d54ebd36cc95ae13844bd00d5bbb2e3ff1a06285.tar.bz2 samba-d54ebd36cc95ae13844bd00d5bbb2e3ff1a06285.zip |
source3/passdb/py_passdb.c: wrap all calls in talloc_stackframe()
dbwrap needs it. Some calls were already wrapped, but they checked the
talloc_stackframe() return unnecessarily: it can never be NULL.
This is the coccinelle patch I used:
// Add in a stackframe to every function: be sure to free it on (every) return
@rule0@
identifier func;
@@
func(...) {
+TALLOC_CTX *frame = talloc_stackframe();
<...
+talloc_free(frame);
return ...;
...>
}
// Get rid of tframe allocation/frees, replace usage with frame.
@rule1@
identifier func;
identifier oldframe;
@@
func(...) {
...
-TALLOC_CTX *oldframe;
...
-if ((oldframe = talloc_stackframe()) == NULL) {
- ...
-}
<...
-talloc_free(oldframe);
...>
}
// Get rid of tframe (variant 2)
@rule2@
identifier func;
identifier oldframe;
@@
func(...) {
...
-TALLOC_CTX *oldframe;
...
-oldframe = talloc_stackframe();
-if (oldframe == NULL) {
- ...
-}
<...
-talloc_free(oldframe);
...>
}
// Change tframe to frame
@rule3@
identifier func;
@@
func(...) {
<...
-tframe
+frame
...>
}
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'source4/torture/ldap/cldap.c')
0 files changed, 0 insertions, 0 deletions