diff options
author | Fulup Ar Foll <fulup@iot.bzh> | 2017-11-05 13:01:07 +0100 |
---|---|---|
committer | Fulup Ar Foll <fulup@iot.bzh> | 2017-11-05 13:01:07 +0100 |
commit | 2e2cf0b8f97c8a72255ab0b977f94bd6c684b203 (patch) | |
tree | 79300297cb13c7be472663841be1ffd9e8177e04 /ahl-policy | |
parent | 68f1187061c28ecf6439b4dd465f4d256529dc55 (diff) |
Added few protection again invalid config
Diffstat (limited to 'ahl-policy')
-rw-r--r-- | ahl-policy/ahl-policy.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/ahl-policy/ahl-policy.c b/ahl-policy/ahl-policy.c index 78e99ae..4fb75c7 100644 --- a/ahl-policy/ahl-policy.c +++ b/ahl-policy/ahl-policy.c @@ -1183,24 +1183,25 @@ void Policy_Term() g_ptr_array_free(g_PolicyCtx.pHALList,TRUE); g_PolicyCtx.pHALList = NULL; } + - for(int i=0; i<g_PolicyCtx.pSourceEndpoints->len; i++) + if (g_PolicyCtx.pSourceEndpoints) for(int i=0; i<g_PolicyCtx.pSourceEndpoints->len; i++) { EndPointPolicyInfoT * pCurEndpoint = &g_array_index(g_PolicyCtx.pSourceEndpoints,EndPointPolicyInfoT,i); g_array_free(pCurEndpoint->streamInfo,TRUE); pCurEndpoint->streamInfo= NULL; } - for(int i=0; i<g_PolicyCtx.pSinkEndpoints->len; i++) + if (g_PolicyCtx.pSinkEndpoints) for(int i=0; i<g_PolicyCtx.pSinkEndpoints->len; i++) { EndPointPolicyInfoT * pCurEndpoint = &g_array_index(g_PolicyCtx.pSinkEndpoints,EndPointPolicyInfoT,i); g_array_free(pCurEndpoint->streamInfo,TRUE); pCurEndpoint->streamInfo = NULL; } - g_array_free(g_PolicyCtx.pSourceEndpoints,TRUE); + if (g_PolicyCtx.pSourceEndpoints) g_array_free(g_PolicyCtx.pSourceEndpoints,TRUE); g_PolicyCtx.pSourceEndpoints = NULL; - g_array_free(g_PolicyCtx.pSinkEndpoints,TRUE); + if (g_PolicyCtx.pSinkEndpoints) g_array_free(g_PolicyCtx.pSinkEndpoints,TRUE); g_PolicyCtx.pSinkEndpoints = NULL; } |