tags 326007 + patch
thanks
On 05/09/06 18:22 +0530, Y Giridhar Appaji Nag - Debian said ...
> (gdb) f 8
> #8 0x0804a9ca in check_cert (pcert=0x80dda30,
> pmd=0xbffff688 "[EMAIL PROTECTED]",
> pmdlen=0xbffff684) at cert.c:126
> 126 xfree(certf);
> (gdb) l
> 121 }
> 122
> 123 fclose(fd);
> 124 X509_free(cert);
> 125
> 126 xfree(certf);
> 127
> 128 return r;
> 129 }
> 130
> (gdb) l check_cert
> [snip...]
> 95
> 96 if (!exists_file(certf))
> 97 return 0;
> 98
> 99 fd = fopen(certf, "r");
> (gdb)
> 100
> 101 xfree(certf);
> 102
> 103 if (fd == NULL)
> 104 return -1;
> [snip...]
> 122
> 123 fclose(fd);
> 124 X509_free(cert);
> 125
> 126 xfree(certf);
>
> So the problem here is that we are xfree-ing certf twice, once at line
> 101 and again on line 126.
The following patch will fix this issue. It also fixes another minor
memory leak in case the certificates file doesn't exist.
--- cert.c.orig 2005-09-06 18:28:37.648230000 +0530
+++ cert.c 2005-09-06 18:28:45.185932000 +0530
@@ -93,8 +93,10 @@
certf = (char *)xmalloc((n + 1) * sizeof(char));
snprintf(certf, n + 1, "%s/%s", env.home, PATHNAME_CERTS);
- if (!exists_file(certf))
+ if (!exists_file(certf)) {
+ xfree(certf);
return 0;
+ }
fd = fopen(certf, "r");
@@ -123,8 +125,6 @@
fclose(fd);
X509_free(cert);
- xfree(certf);
-
return r;
}
Ulf, can you please check if it works for you as well?
Giridhar
--
Y Giridhar Appaji Nag | http://www.appaji.net/
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]