Browse code

geoip2: fix logging for reload failures, initialize memory for db

Henning Westerholt authored on 13/04/2022 08:20:54
Showing 1 changed files
... ...
@@ -490,6 +490,8 @@ int geoip2_init_pv(char *path)
490 490
 {
491 491
 	int status;
492 492
 	_handle_GeoIP = shm_malloc(sizeof(struct MMDB_s));
493
+	memset(_handle_GeoIP, 0, sizeof(struct MMDB_s));
494
+
493 495
 	if (_handle_GeoIP == NULL)
494 496
 	{
495 497
 		SHM_MEM_ERROR;
... ...
@@ -522,9 +524,13 @@ int geoip2_reload_pv(char *path)
522 524
 	if(MMDB_SUCCESS != status)
523 525
 	{
524 526
 		LM_ERR("cannot reload GeoIP database file at: %s\n", path);
527
+
528
+	}
529
+	else
530
+	{
531
+		LM_INFO("reloaded GeoIP database file at: %s\n", path);
525 532
 	}
526 533
 	lock_release(lock);
527
-	LM_INFO("reloaded GeoIP database file at: %s\n", path);
528 534
 
529 535
 	return status;
530 536
 }