Skip to contentSkip to conversation

ssl.c: remove unneeded local variable

PATCH In review Lev Stipakov 2 participants 2 messages Feb 17, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ssl.c: remove unneeded local variable

From: Lev Stipakov <[email protected]...>

Remove unneeded _orig variable, which stores pointer to tokenized string. Unlike strsep(), strtok() doesn't modify pointer itself, only string, so it is safe to call free() on that pointer.

---
 src/openvpn/ssl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
src/openvpn/ssl.c +1 -2
index e708fc93..b92aada3 100644
@@ -1918,7 +1918,6 @@ bool
 tls_item_in_cipher_list(const char *item, const char *list)
 {
     char *tmp_ciphers = string_alloc(list, NULL);
-    char *tmp_ciphers_orig = tmp_ciphers;
 
     const char *token = strtok(tmp_ciphers, ":");
     while (token)
@@ -1929,7 +1928,7 @@ tls_item_in_cipher_list(const char *item, const char *list)
         }
         token = strtok(NULL, ":");
     }
-    free(tmp_ciphers_orig);
+    free(tmp_ciphers);
 
     return token != NULL;
 }
Signature · 1 line
2.17.1
#1 lore raw

Am 17.02.20 um 10:20 schrieb Lev Stipakov:

Quoted 7 lines

From: Lev Stipakov <[email protected]...>

Remove unneeded _orig variable, which stores pointer to tokenized string. Unlike strsep(), strtok() doesn't modify pointer itself, only string, so it is safe to call free() on that pointer.

Can we just wait with style patches like that that create conflicts with
a large patchset like my NCP patchset until those larger patches are
handled?

Arne