diff src/protocols/oscar/locate.c @ 8393:8deb49dea682

[gaim-migrate @ 9122] Fix a GINORMOUS memleak of ZERO bytes. You heard me. I installed Gentoo for THIS? I'm off to get my 5 hours of sleep. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 03 Mar 2004 07:23:30 +0000
parents 59e83fdb753e
children a41efeb3a9ee
line wrap: on
line diff
--- a/src/protocols/oscar/locate.c	Wed Mar 03 06:26:02 2004 +0000
+++ b/src/protocols/oscar/locate.c	Wed Mar 03 07:23:30 2004 +0000
@@ -241,8 +241,10 @@
 	if (userinfo->info != NULL) {
 		free(cur->info);
 		free(cur->info_encoding);
-		cur->info = (char *)malloc(userinfo->info_len);
-		memcpy(cur->info, userinfo->info, userinfo->info_len);
+		if (userinfo->info_len > 0) {
+			cur->info = (char *)malloc(userinfo->info_len);
+			memcpy(cur->info, userinfo->info, userinfo->info_len);
+		}
 		cur->info_encoding = strdup(userinfo->info_encoding);
 		cur->info_len = userinfo->info_len;
 	}
@@ -250,8 +252,10 @@
 	if (userinfo->away != NULL) {
 		free(cur->away);
 		free(cur->away_encoding);
-		cur->away = (char *)malloc(userinfo->away_len);
-		memcpy(cur->away, userinfo->away, userinfo->away_len);
+		if (userinfo->away_len > 0) {
+			cur->away = (char *)malloc(userinfo->away_len);
+			memcpy(cur->away, userinfo->away, userinfo->away_len);
+		}
 		cur->away_encoding = strdup(userinfo->away_encoding);
 		cur->away_len = userinfo->away_len;
 	}