1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

pyldb: add a macro to free when raising exceptions

We often forget.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Douglas Bagnall 2024-02-22 11:19:30 +13:00 committed by Andrew Bartlett
parent 8cf9d4cae1
commit cccc994fa0

View File

@ -110,7 +110,15 @@ typedef struct {
} \
} while(0)
/* Picked out of thin air. To do this properly, we should probably have some part of the
#define PyErr_LDB_ERROR_IS_ERR_RAISE_FREE(err,ret,ldb,mem_ctx) do { \
if (ret != LDB_SUCCESS) { \
PyErr_SetLdbError(err, ret, ldb); \
TALLOC_FREE(mem_ctx); \
return NULL; \
} \
} while(0)
/* Picked out of thin air. To do this properly, we should probably have some part of the
* errors in LDB be allocated to bindings ? */
#define LDB_ERR_PYTHON_EXCEPTION 142