[vlc-commits] commit: Growl: fix bad memset. ( Rémi Duraffort )

git at videolan.org git at videolan.org
Sat Apr 17 11:58:52 CEST 2010


vlc/vlc-1.0 | branch: master | Rémi Duraffort <ivoire at videolan.org> | Sun Mar 28 17:50:35 2010 +0200| [3b9cc9e667fe3b67f5caf83784c56d2d4ff5eb67] | committer: Rémi Duraffort 

Growl: fix bad memset.
(cherry picked from commit 7b7d26d88a500582c22f47a8c5e6d001967dd491)

Signed-off-by: Rémi Duraffort <ivoire at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.0.git/?a=commit;h=3b9cc9e667fe3b67f5caf83784c56d2d4ff5eb67
---

 modules/misc/notify/growl_udp.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/modules/misc/notify/growl_udp.c b/modules/misc/notify/growl_udp.c
index f66db4c..8fffe27 100644
--- a/modules/misc/notify/growl_udp.c
+++ b/modules/misc/notify/growl_udp.c
@@ -186,7 +186,7 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
  *****************************************************************************/
 static int RegisterToGrowl( vlc_object_t *p_this )
 {
-    uint8_t *psz_encoded = malloc(100);
+    uint8_t *psz_encoded = calloc( 100, 1 );
     uint8_t i_defaults = 0;
     static const char *psz_notifications[] = {"Now Playing", NULL};
     bool pb_defaults[] = {true, false};
@@ -194,7 +194,6 @@ static int RegisterToGrowl( vlc_object_t *p_this )
     if( psz_encoded == NULL )
         return false;
 
-    memset( psz_encoded, 0, sizeof(psz_encoded) );
     psz_encoded[i++] = GROWL_PROTOCOL_VERSION;
     psz_encoded[i++] = GROWL_TYPE_REGISTRATION;
     insertstrlen(APPLICATION_NAME);
@@ -226,13 +225,12 @@ static int RegisterToGrowl( vlc_object_t *p_this )
 static int NotifyToGrowl( vlc_object_t *p_this, const char *psz_desc )
 {
     const char *psz_type = "Now Playing", *psz_title = "Now Playing";
-    uint8_t *psz_encoded = malloc(GROWL_MAX_LENGTH + 42);
+    uint8_t *psz_encoded = calloc(GROWL_MAX_LENGTH + 42, 1);
     uint16_t flags;
     int i = 0;
     if( psz_encoded == NULL )
         return false;
 
-    memset( psz_encoded, 0, sizeof(psz_encoded) );
     psz_encoded[i++] = GROWL_PROTOCOL_VERSION;
     psz_encoded[i++] = GROWL_TYPE_NOTIFICATION;
     flags = 0;



More information about the vlc-commits mailing list