[vlc-commits] [Git][videolan/vlc][master] keystore: file: fix leak on failure path

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Aug 28 09:11:32 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
a6e94989 by Alexandre Janniaux at 2026-08-28T08:57:39+00:00
keystore: file: fix leak on failure path

When vlc_keystore_entry_set_secret fails, the function jump at the end
label but doesn't free the allocated encrypted secret. It would be a bit
weird to put the free() in the `end:` label also given that this
function has two implementation depending on password encrypting support
so instead just release it right after the call.

- - - - -


1 changed file:

- modules/keystore/file.c


Changes:

=====================================
modules/keystore/file.c
=====================================
@@ -363,10 +363,11 @@ Store(vlc_keystore *p_keystore, const char *const ppsz_values[KEY_MAX],
         if (i_enc_secret_len == 0)
             goto end;
 
-        if (vlc_keystore_entry_set_secret(p_entry, p_enc_secret,
-                                          i_enc_secret_len))
-            goto end;
+        int ret = vlc_keystore_entry_set_secret(p_entry, p_enc_secret,
+                                                  i_enc_secret_len);
         free(p_enc_secret);
+        if (ret)
+            goto end;
     }
     else
 #endif



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/a6e94989ca5e591a2381addc2f3423047c4dd77e

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/a6e94989ca5e591a2381addc2f3423047c4dd77e
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list