From 1a43a4868f11b1b8f4bf5672d817877e4c2fa981 Mon Sep 17 00:00:00 2001 From: VilhoRaatikka Date: Thu, 5 Jun 2014 20:17:39 +0300 Subject: [PATCH] Added check for NULL pointer in serviceClearRouterOptions. --- server/core/service.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/server/core/service.c b/server/core/service.c index c1b54c0af..d963987d5 100644 --- a/server/core/service.c +++ b/server/core/service.c @@ -542,10 +542,13 @@ serviceClearRouterOptions(SERVICE *service) int i; spinlock_acquire(&service->spin); - for (i = 0; service->routerOptions[i]; i++) - free(service->routerOptions[i]); - free(service->routerOptions); - service->routerOptions = NULL; + if (service->routerOptions != NULL) + { + for (i = 0; service->routerOptions[i]; i++) + free(service->routerOptions[i]); + free(service->routerOptions); + service->routerOptions = NULL; + } spinlock_release(&service->spin); } /**