summaryrefslogtreecommitdiffstats
path: root/libcli
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-10-16 17:04:19 +1100
committerAndrew Tridgell <tridge@samba.org>2009-10-17 13:01:02 +1100
commitb6a1beb13139a6aa89ac1d4bb201a9c9d1453262 (patch)
treef38fc6ba7ab4cf85f684861178abc048757723a3 /libcli
parentf1d9960284b3087189f2140274ae2c9da9609060 (diff)
downloadsamba-b6a1beb13139a6aa89ac1d4bb201a9c9d1453262.tar.gz
samba-b6a1beb13139a6aa89ac1d4bb201a9c9d1453262.tar.xz
samba-b6a1beb13139a6aa89ac1d4bb201a9c9d1453262.zip
added NT_STATUS_NOT_OK_RETURN_AND_FREE()
Try to make it a bit easier to avoid leaks in common code
Diffstat (limited to 'libcli')
-rw-r--r--libcli/util/ntstatus.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/libcli/util/ntstatus.h b/libcli/util/ntstatus.h
index 1025f47210..88b4353c1d 100644
--- a/libcli/util/ntstatus.h
+++ b/libcli/util/ntstatus.h
@@ -674,6 +674,13 @@ extern bool ntstatus_check_dos_mapping;
}\
} while (0)
+#define NT_STATUS_NOT_OK_RETURN_AND_FREE(x, ctx) do { \
+ if (!NT_STATUS_IS_OK(x)) {\
+ talloc_free(ctx); \
+ return x;\
+ }\
+} while (0)
+
#define NT_STATUS_IS_ERR_RETURN(x) do { \
if (NT_STATUS_IS_ERR(x)) {\
return x;\