Package: manpages-dev
Version: 1.70-1
Hi,
Me apologies for such an insignificant bug, but any improvement is an
improvement right?
The example at the bottom of printf(3) demonstrating the use of
vsnprintf does not free the buffer (char *p) if realloc fails when
trying to resize the buffer.
Diff below:
--- printf.3.orig 2005-06-23 10:12:42.741038016 +0200
+++ printf.3 2005-06-23 10:14:29.386825392 +0200
@@ -761,6 +761,7 @@
/* Guess we need no more than 100 bytes. */
int n, size = 100;
char *p;
+ char *tmp;
va_list ap;
if ((p = malloc (size)) == NULL)
return NULL;
@@ -777,8 +778,12 @@
size = n+1; /* precisely what is needed */
else /* glibc 2.0 */
size *= 2; /* twice the old size */
- if ((p = realloc (p, size)) == NULL)
+ if ((tmp = realloc (p, size)) == NULL){
+ free(p);
return NULL;
+ }else{
+ p = tmp;
+ }
}
}
.fi
Cheers,
Jesse
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]