From 57b5f962c298199d9ff1b99a04a2fbddd98e8eeb Mon Sep 17 00:00:00 2001 From: Patrik Flykt Date: Wed, 25 Jan 2012 13:49:39 +0200 Subject: [PATCH] vpn: Add check for properly initialized driver_hash --- plugins/vpn.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/vpn.c b/plugins/vpn.c index 9f49f32..a6ac5b9 100644 --- a/plugins/vpn.c +++ b/plugins/vpn.c @@ -484,10 +484,15 @@ int vpn_register(const char *name, struct vpn_driver *vpn_driver, data->provider_driver.remove = vpn_remove; data->provider_driver.save = vpn_save; - if (driver_hash == NULL) { + if (driver_hash == NULL) driver_hash = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); + + if (driver_hash == NULL) { + connman_error("driver_hash not initialized for %s", name); + g_free(data); + return -ENOMEM; } g_hash_table_insert(driver_hash, (char *)name, data); -- 2.7.4