Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Aug 2008 11:16:08 GMT
From:      Konrad Jankowski <konrad@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 147710 for review
Message-ID:  <200808181116.m7IBG8i8023741@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=147710

Change 147710 by konrad@vspredator on 2008/08/18 11:15:11

	Fix memory leak in wcsxfrm - analogous to the fix to strxfrm earlier this week.

Affected files ...

.. //depot/projects/soc2008/konrad_collation/libc/string/wcsxfrm.c#7 edit

Differences ...

==== //depot/projects/soc2008/konrad_collation/libc/string/wcsxfrm.c#7 (text+ko) ====

@@ -43,8 +43,9 @@
 wcsxfrm(wchar_t * __restrict dest, const wchar_t * __restrict src, size_t len)
 {
 	size_t slen;
-	wchar_t *xf[2];
+	wchar_t *xf[COLL_WEIGHTS_MAX];
 	int sverrno;
+	int i;
 
 	if (*src == L'\0') {
 		if (len != 0)
@@ -91,8 +92,9 @@
 		*dest = 0;
  	}
 	sverrno = errno;
-	free(xf[0]);
-	free(xf[1]);
+	for (i = 0; i < __collate_data->__info.directive_count; i++) {
+		free(xf[i]);
+	}
 	errno = sverrno;
  
 	return (slen);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808181116.m7IBG8i8023741>