60 строки
1.6 KiB
Diff
60 строки
1.6 KiB
Diff
From abc0836d587862ba512acf4d4fafcf8cb121bf0a Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= <olysonek@redhat.com>
|
|
Date: Mon, 13 Aug 2018 14:39:44 +0200
|
|
Subject: [PATCH 3/7] Fix file descriptor leaks
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
|
|
---
|
|
src/dial.c | 5 +++++
|
|
1 file changed, 5 insertions(+)
|
|
|
|
diff --git a/src/dial.c b/src/dial.c
|
|
index a3337e5..eada5ee 100644
|
|
--- a/src/dial.c
|
|
+++ b/src/dial.c
|
|
@@ -912,6 +912,7 @@ int readdialdir(void)
|
|
if (fread(&dial_ver, sizeof(dial_ver), 1, fp) != 1)
|
|
{
|
|
werror(_("Failed to read dialing directory\n"));
|
|
+ fclose(fp);
|
|
return -1;
|
|
}
|
|
if (dial_ver.magic != DIALMAGIC) {
|
|
@@ -947,12 +948,14 @@ int readdialdir(void)
|
|
dial_ver.size > sizeof(struct v4_dialent)) {
|
|
werror(_("Phonelist garbled (unknown version?)"));
|
|
dialents = mkstdent();
|
|
+ fclose(fp);
|
|
return -1;
|
|
}
|
|
break;
|
|
case 5:
|
|
if (dial_ver.size != sizeof(struct dialent)) {
|
|
werror(_("Phonelist corrupted"));
|
|
+ fclose(fp);
|
|
return -1;
|
|
}
|
|
break;
|
|
@@ -961,6 +964,7 @@ int readdialdir(void)
|
|
// have different size on 32 and 64bit systems
|
|
if (dial_ver.size != sizeof(struct dialent) - sizeof(void *)) {
|
|
werror(_("Phonelist corrupted"));
|
|
+ fclose(fp);
|
|
return -1;
|
|
}
|
|
break;
|
|
@@ -968,6 +972,7 @@ int readdialdir(void)
|
|
werror(_("Unknown dialing directory version"));
|
|
dendd = 1;
|
|
dialents = mkstdent();
|
|
+ fclose(fp);
|
|
return -1;
|
|
}
|
|
|
|
--
|
|
2.14.4
|
|
|