Fix memory leaks and dereference without null check
[platform/upstream/connman.git] / vpn / plugins / openvpn.c
index 9e8cceb..ef0bf78 100755 (executable)
@@ -152,8 +152,15 @@ static struct nameserver_entry *ov_append_dns_entries(const char *key,
                                options[2]) {
 
                entry = g_try_new(struct nameserver_entry, 1);
+#if defined TIZEN_EXT
+               if (!entry) {
+                       g_strfreev(options);
+                       return NULL;
+               }
+#else
                if (!entry)
                        return NULL;
+#endif
 
                entry->nameserver = g_strdup(options[2]);
                entry->id = atoi(key + 15); /* foreign_option_XXX */