Commit Diff


commit - c550e428fb249028df8f7d2d39a06b3a06cc77eb
commit + ed1844176011f28206a6be689f50b68a591770b1
blob - 58435a5acd23d9c141c54f360faeb1597deb809b
blob + d11c324e69f1bfe47d95b100ce55a647fef4587c
--- utf8.c
+++ utf8.c
@@ -43,8 +43,10 @@ mbs2ws(wchar_t **ws, size_t *wlen, const char *s)
 		if (err)
 			return err;
 		*wlen = mbstowcs(NULL, vis, 0);
-		if (*wlen == (size_t)-1)
+		if (*wlen == (size_t)-1) {
+			free(vis);
 			return -1; /* give up */
+		}
 	}
 
 	*ws = calloc(*wlen + 1, sizeof(**ws));