gnome-terminal r2473 - trunk/src/skey



Author: chpe
Date: Wed Mar 19 18:10:09 2008
New Revision: 2473
URL: http://svn.gnome.org/viewvc/gnome-terminal?rev=2473&view=rev

Log:
Fix some compiler warnings.


Modified:
   trunk/src/skey/md5.c
   trunk/src/skey/sha1.c

Modified: trunk/src/skey/md5.c
==============================================================================
--- trunk/src/skey/md5.c	(original)
+++ trunk/src/skey/md5.c	Wed Mar 19 18:10:09 2008
@@ -18,6 +18,7 @@
 #include <config.h>
 #include <stdlib.h>
 
+#include <string.h>
 #include <glib/gchecksum.h>
 
 #include "skey.h"
@@ -34,7 +35,7 @@
 	guint32 *results;
 
 	len = strlen(seed) + strlen(passhrase);
-	buf = (char *)malloc(len+1);
+	buf = (char *)g_try_malloc(len+1);
 	if (buf == NULL)
 		return -1;
 
@@ -45,7 +46,7 @@
 
         checksum = g_checksum_new (G_CHECKSUM_MD5);
         g_checksum_update (checksum, (const guchar *) buf, len);
-	free(buf);
+	g_free(buf);
 
         g_checksum_get_digest (checksum, digest, &digest_len);
         g_assert (digest_len == 16);

Modified: trunk/src/skey/sha1.c
==============================================================================
--- trunk/src/skey/sha1.c	(original)
+++ trunk/src/skey/sha1.c	Wed Mar 19 18:10:09 2008
@@ -14,6 +14,7 @@
 
 #include <config.h>
 
+#include <string.h>
 #include <stdlib.h>
 #include <arpa/inet.h>
 
@@ -61,7 +62,7 @@
 	guint32 *results;
 
 	len = strlen(seed) + strlen(passphrase);
-	if ((buf = (char *)malloc(len+1)) == NULL)
+	if ((buf = (char *)g_try_malloc(len+1)) == NULL)
 		return -1;
 
 	strcpy(buf, seed);
@@ -71,7 +72,7 @@
 
         checksum = g_checksum_new (G_CHECKSUM_SHA1);
         g_checksum_update (checksum, (const guchar *) buf, len);
-	free(buf);
+	g_free(buf);
 
         g_checksum_get_digest (checksum, digest, &digest_len);
         g_assert (digest_len == 20);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]