W_ERROR_HAVE_NO_MEMORY and friends
Volker Lendecke
Volker.Lendecke at SerNet.DE
Wed May 30 09:00:43 MDT 2012
On Wed, May 30, 2012 at 10:03:18PM +1000, Andrew Bartlett wrote:
> #define NT_STATUS_HAVE_NO_MEMORY_AND_FREE(x, ctx) do { \
> if (!(x)) {\
> talloc_free(ctx); \
> return NT_STATUS_NO_MEMORY;\
> }\
> } 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)
>
> These 'simple' macros do a lot, but also save a lot of repeated code
> that we tend to get wrong. But it is easy to look down a page of code
> and confirm that all the error handling macros look the same.
S3 tries to protect against that exact example by pervasive
use of talloc_tos() and talloc_stackframe().
Volker
--
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
More information about the samba-technical
mailing list