public
/
ack.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d6e6583
)
Fix resource leak.
author
David Given
<dg@cowlark.com>
Sat, 2 Jun 2018 18:59:11 +0000
(20:59 +0200)
committer
David Given
<dg@cowlark.com>
Sat, 2 Jun 2018 18:59:11 +0000
(20:59 +0200)
Closes: #75
lang/cem/libcc.ansi/misc/termcap.c
patch
|
blob
|
history
diff --git
a/lang/cem/libcc.ansi/misc/termcap.c
b/lang/cem/libcc.ansi/misc/termcap.c
index
2916252
..
92629fd
100644
(file)
--- a/
lang/cem/libcc.ansi/misc/termcap.c
+++ b/
lang/cem/libcc.ansi/misc/termcap.c
@@
-58,6
+58,7
@@
int tgetent(char* bp, const char* name)
}
else
file = "/etc/termcap";
+
if ((fp = fopen(file, "r")) == (FILE*)NULL)
return (-1);
while (fgets(buf, 1024, fp) != NULL)
@@
-66,7
+67,7
@@
int tgetent(char* bp, const char* name)
continue;
while (*(cp = &buf[strlen(buf) - 2]) == '\\')
if (fgets(cp, 1024, fp) == NULL)
-
return (0)
;
+
goto exit
;
if (match_name(buf, name))
{
strcpy(bp, buf);
@@
-74,6
+75,7
@@
int tgetent(char* bp, const char* name)
return (check_for_tc());
}
}
+exit:
fclose(fp);
return (0);
}