* mdocml: First memory leak in mandocdb.c freeing "struct of".
@ 2011-12-25 19:31 kristaps
0 siblings, 0 replies; only message in thread
From: kristaps @ 2011-12-25 19:31 UTC (permalink / raw)
To: source
Log Message:
-----------
First memory leak in mandocdb.c freeing "struct of". Also properly
const-ify several strings.
Modified Files:
--------------
mdocml:
mandocdb.c
Revision Data
-------------
Index: mandocdb.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandocdb.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -Lmandocdb.c -Lmandocdb.c -u -p -r1.40 -r1.41
--- mandocdb.c
+++ mandocdb.c
@@ -1452,7 +1452,8 @@ static void
ofile_argbuild(int argc, char *argv[], struct of **of)
{
char buf[MAXPATHLEN];
- char *sec, *arch, *title, *p;
+ const char *sec, *arch, *title;
+ char *p;
int i, src_form;
struct of *nof;
@@ -1756,6 +1757,7 @@ ofile_dirbuild(const char *dir, const ch
if (verb > 1)
printf("%s: scheduling\n", buf);
+
if (NULL == *of) {
*of = nof;
(*of)->first = nof;
@@ -1774,7 +1776,10 @@ ofile_free(struct of *of)
{
struct of *nof;
- while (of) {
+ if (NULL != of)
+ of = of->first;
+
+ while (NULL != of) {
nof = of->next;
free(of->fname);
free(of->sec);
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-12-25 19:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-25 19:31 mdocml: First memory leak in mandocdb.c freeing "struct of" kristaps
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).