diff options
| author | Michael Biebl <biebl@debian.org> | 2021-08-16 09:51:46 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2021-08-16 09:51:46 +0200 |
| commit | bfe522304da217296e2a61040f58e35ec5d6f3f2 (patch) | |
| tree | 6c4296644fa59cbfe51d9e8aafebddace5ac6b6f /libnm/nm-vpn-service-plugin.c | |
| parent | 3a56bce6c0ea7ba0fe269520547740783b342e0d (diff) | |
New upstream version 1.30.6 upstream/1.30.6
Diffstat (limited to 'libnm/nm-vpn-service-plugin.c')
| -rw-r--r-- | libnm/nm-vpn-service-plugin.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/libnm/nm-vpn-service-plugin.c b/libnm/nm-vpn-service-plugin.c index 34de21b8..bf5f292f 100644 --- a/libnm/nm-vpn-service-plugin.c +++ b/libnm/nm-vpn-service-plugin.c @@ -755,11 +755,11 @@ nm_vpn_service_plugin_read_vpn_details(int fd, GHashTable **out_data, GHashTable gs_unref_hashtable GHashTable *secrets = NULL; gboolean success = FALSE; GHashTable * hash = NULL; - GString * key = NULL, *val = NULL; - nm_auto_free_gstring GString *line = NULL; + nm_auto_free_gstring GString *key = NULL; + nm_auto_free_gstring GString *val = NULL; + nm_auto_free_gstring GString *line = NULL; char c; - - GString *str = NULL; + GString * str = NULL; if (out_data) g_return_val_if_fail(*out_data == NULL, FALSE); @@ -807,16 +807,12 @@ nm_vpn_service_plugin_read_vpn_details(int fd, GHashTable **out_data, GHashTable /* finish marker */ break; } else if (strncmp(line->str, DATA_KEY_TAG, strlen(DATA_KEY_TAG)) == 0) { - if (key != NULL) { + if (nm_clear_g_string(&key)) g_warning("a value expected"); - g_string_free(key, TRUE); - } key = g_string_new(line->str + strlen(DATA_KEY_TAG)); str = key; hash = data; } else if (strncmp(line->str, DATA_VAL_TAG, strlen(DATA_VAL_TAG)) == 0) { - if (val != NULL) - g_string_free(val, TRUE); if (val || !key || hash != data) { g_warning("%s not preceded by %s", DATA_VAL_TAG, DATA_KEY_TAG); break; @@ -824,16 +820,12 @@ nm_vpn_service_plugin_read_vpn_details(int fd, GHashTable **out_data, GHashTable val = g_string_new(line->str + strlen(DATA_VAL_TAG)); str = val; } else if (strncmp(line->str, SECRET_KEY_TAG, strlen(SECRET_KEY_TAG)) == 0) { - if (key != NULL) { + if (nm_clear_g_string(&key)) g_warning("a value expected"); - g_string_free(key, TRUE); - } key = g_string_new(line->str + strlen(SECRET_KEY_TAG)); str = key; hash = secrets; } else if (strncmp(line->str, SECRET_VAL_TAG, strlen(SECRET_VAL_TAG)) == 0) { - if (val != NULL) - g_string_free(val, TRUE); if (val || !key || hash != secrets) { g_warning("%s not preceded by %s", SECRET_VAL_TAG, SECRET_KEY_TAG); break; |