aboutsummaryrefslogtreecommitdiff
path: root/src/survive.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/survive.c')
-rwxr-xr-xsrc/survive.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/survive.c b/src/survive.c
index 61bfc86..a27ba3e 100755
--- a/src/survive.c
+++ b/src/survive.c
@@ -297,7 +297,9 @@ int survive_send_magic( SurviveContext * ctx, int magic_code, void * data, int d
int i;
for( i = 0; i < oldct; i++ )
{
- ctx->drivermagics[i]( ctx, ctx->drivers[i], magic_code, data, datalen );
+ if (ctx->drivermagics[i]) {
+ ctx->drivermagics[i](ctx, ctx->drivers[i], magic_code, data, datalen);
+ }
}
return 0;
}
@@ -338,7 +340,8 @@ void survive_close( SurviveContext * ctx )
{
PoserData pd;
pd.pt = POSERDATA_DISASSOCIATE;
- if( ctx->objs[i]->PoserFn ) ctx->objs[i]->PoserFn( ctx->objs[i], &pd );
+ if (ctx->objs[i]->PoserFn)
+ ctx->objs[i]->PoserFn(ctx->objs[i], &pd);
}
for( i = 0; i < oldct; i++ )
@@ -352,6 +355,10 @@ void survive_close( SurviveContext * ctx )
destroy_config_group(ctx->global_config_values);
destroy_config_group(ctx->lh_config);
+ for (i = 0; i < ctx->objs_ct; i++) {
+ free(ctx->objs[i]);
+ }
+
free( ctx->objs );
free( ctx->drivers );
free( ctx->driverpolls );