aboutsummaryrefslogtreecommitdiff
path: root/src/survive.c
diff options
context:
space:
mode:
authorCNLohr <charles@cnlohr.com>2018-03-16 00:02:03 -0400
committerGitHub <noreply@github.com>2018-03-16 00:02:03 -0400
commit6e67cc1996fbcba36e11cb281c78d3b00c4de85d (patch)
tree543390fcbd17dfce8845dff942fc6ecd928270b7 /src/survive.c
parent61a01d0ddfd8e99c97e3d235d4f0782fbf0ed032 (diff)
parent029b2909b37cc58ba35e0f46be1802866ee59730 (diff)
downloadlibsurvive-6e67cc1996fbcba36e11cb281c78d3b00c4de85d.tar.gz
libsurvive-6e67cc1996fbcba36e11cb281c78d3b00c4de85d.tar.bz2
Merge pull request #113 from cnlohr/epnp
Epnp
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 );