added NT_STATUS_NOT_OK_RETURN_AND_FREE()
authorAndrew Tridgell <tridge@samba.org>
Fri, 16 Oct 2009 06:04:19 +0000 (17:04 +1100)
committerAndrew Tridgell <tridge@samba.org>
Sat, 17 Oct 2009 02:01:02 +0000 (13:01 +1100)
Try to make it a bit easier to avoid leaks in common code

libcli/util/ntstatus.h

index 1025f472104f2ba027a680e4191a9efaa20c5aed..88b4353c1d1c02439a3387df11ebdbe3a31aab08 100644 (file)
@@ -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;\