[vlc-commits] macosx: fix some strdup memleaks

David Fuhrmann git at videolan.org
Thu Jul 11 20:23:53 CEST 2013


vlc/vlc-2.1 | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Thu Jul 11 20:17:04 2013 +0200| [7eb396d0b5126c8c661cb0adb9303fe691521f78] | committer: David Fuhrmann

macosx: fix some strdup memleaks
(cherry picked from commit 227fb138bcf11fb80f280d07bf9a757d6355f43c)

Signed-off-by: David Fuhrmann <david.fuhrmann at googlemail.com>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.1.git/?a=commit;h=7eb396d0b5126c8c661cb0adb9303fe691521f78
---

 modules/gui/macosx/prefs_widgets.m |    7 +++++--
 modules/gui/macosx/simple_prefs.m  |    2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/modules/gui/macosx/prefs_widgets.m b/modules/gui/macosx/prefs_widgets.m
index b956b9e..60553b8 100644
--- a/modules/gui/macosx/prefs_widgets.m
+++ b/modules/gui/macosx/prefs_widgets.m
@@ -859,9 +859,12 @@ o_textfield = [[[NSSecureTextField alloc] initWithFrame: s_rc] retain];     \
     case CONFIG_ITEM_DIRECTORY:
     case CONFIG_ITEM_MODULE:
     case CONFIG_ITEM_MODULE_LIST:
-    case CONFIG_ITEM_MODULE_LIST_CAT:
-        config_PutPsz(VLCIntf, psz_name, [self stringValue]);
+    case CONFIG_ITEM_MODULE_LIST_CAT: {
+        char *psz_val = [self stringValue];
+        config_PutPsz(VLCIntf, psz_name, psz_val);
+        free(psz_val);
         break;
+    }
     case CONFIG_ITEM_KEY:
         /* So you don't need to restart to have the changes take effect */
         val.i_int = [self intValue];
diff --git a/modules/gui/macosx/simple_prefs.m b/modules/gui/macosx/simple_prefs.m
index 8a0cfb0..2b60f49 100644
--- a/modules/gui/macosx/simple_prefs.m
+++ b/modules/gui/macosx/simple_prefs.m
@@ -771,7 +771,7 @@ static inline void save_module_list(intf_thread_t * p_intf, id object, const cha
 
         if (p_item->i_type == CONFIG_ITEM_MODULE && module_provides(p_parser, p_item->psz_type)) {
             if ([objectTitle isEqualToString: _NS(module_GetLongName(p_parser))]) {
-                config_PutPsz(p_intf, name, strdup(module_get_name(p_parser, false)));
+                config_PutPsz(p_intf, name, module_get_name(p_parser, false));
                 break;
             }
         }



More information about the vlc-commits mailing list