diff options
author | David Sommerseth <dazo@users.sourceforge.net> | 2009-09-07 21:10:22 +0200 |
---|---|---|
committer | David Sommerseth <dazo@users.sourceforge.net> | 2009-09-07 21:10:22 +0200 |
commit | 66b29488a7ed5909564ed03b3e89cd0d008df09e (patch) | |
tree | 2ef1558a3c54b37b59a775f4734cb467cac183cb /plugin/firewall | |
parent | 428d4fd45100c5c9b799f2fb127775b8b2382ecc (diff) | |
download | eurephia-66b29488a7ed5909564ed03b3e89cd0d008df09e.tar.gz eurephia-66b29488a7ed5909564ed03b3e89cd0d008df09e.tar.xz eurephia-66b29488a7ed5909564ed03b3e89cd0d008df09e.zip |
Moved all malloc() operations over to a calloc wrapper, malloc_nullsafe()
This also improves debugging as well, if debug logging is enabled and log level is >= 40.
Diffstat (limited to 'plugin/firewall')
-rw-r--r-- | plugin/firewall/eurephiafw.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/plugin/firewall/eurephiafw.c b/plugin/firewall/eurephiafw.c index 0ee83de..10d48a7 100644 --- a/plugin/firewall/eurephiafw.c +++ b/plugin/firewall/eurephiafw.c @@ -38,6 +38,7 @@ #include <sys/mman.h> #include <sys/wait.h> #include <time.h> +#include <assert.h> #define EUREPHIA_FWINTF #include <eurephiafw_struct.h> @@ -139,12 +140,11 @@ void eFW_StartFirewall(eurephiaCTX *ctx) { char buf[1026], *fwdest = NULL; unsigned int prio; - ctx->fwcfg = (eurephiaFWINTF *) malloc(sizeof(eurephiaFWINTF)+2); - memset(ctx->fwcfg, 0, sizeof(eurephiaFWINTF)+2); + ctx->fwcfg = (eurephiaFWINTF *) malloc_nullsafe(ctx, sizeof(eurephiaFWINTF)+2); // Create a fake eurephia context, just for logging - shadowctx = (eurephiaCTX *) malloc(sizeof(eurephiaCTX)+2); - memset(shadowctx, 0, sizeof(eurephiaCTX)+2); + shadowctx = (eurephiaCTX *) malloc_nullsafe(ctx, sizeof(eurephiaCTX)+2); + assert( shadowctx != NULL ); shadowctx->context_type = ECTX_NO_PRIVILEGES; shadowctx->loglevel = ctx->loglevel; shadowctx->log = ctx->log; |