1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
From 314f9d8f4fc50323e9f670ef54f0263cec08abc3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=96mer=20Fad=C4=B1l=20USTA?= <omerusta@gmail.com>
Date: Tue, 9 Apr 2013 04:01:23 +0300
Subject: [PATCH 2/5] Reduce noise in analysis tools complain about resource
leak
Cppcheck gives false alerts. This will stop it complaining about
resource leakage.
Thanks to mpyne for review of patch
REVIEW: 109920
---
lib/fileinputstream.cpp | 4 ++--
lib/skippingfileinputstream.cpp | 4 ++--
lib/skippingfileinputstream2.cpp | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/fileinputstream.cpp b/lib/fileinputstream.cpp
index 2801d1b..820b831 100644
--- a/lib/fileinputstream.cpp
+++ b/lib/fileinputstream.cpp
@@ -39,8 +39,8 @@ FileInputStream::FileInputStream(const char* filepath, int32_t buffersize) {
m_status = Error;
return;
}
- FILE* f = fopen(filepath, "rb");
- open(f, filepath, buffersize);
+ file = fopen(filepath, "rb");
+ open(file, filepath, buffersize);
}
FileInputStream::FileInputStream(FILE* file, const char* filepath,
int32_t buffersize) {
diff --git a/lib/skippingfileinputstream.cpp b/lib/skippingfileinputstream.cpp
index dcb4d32..9759c54 100644
--- a/lib/skippingfileinputstream.cpp
+++ b/lib/skippingfileinputstream.cpp
@@ -38,8 +38,8 @@ SkippingFileInputStream::SkippingFileInputStream(const char* filepath) {
m_status = Error;
return;
}
- FILE* f = fopen(filepath, "rb");
- open(f, filepath);
+ file = fopen(filepath, "rb");
+ open(file, filepath);
}
void
SkippingFileInputStream::open(FILE* f, const char* path) {
diff --git a/lib/skippingfileinputstream2.cpp b/lib/skippingfileinputstream2.cpp
index dc618f4..dcfcef2 100644
--- a/lib/skippingfileinputstream2.cpp
+++ b/lib/skippingfileinputstream2.cpp
@@ -36,8 +36,8 @@ SkippingFileInputStream2::SkippingFileInputStream2(const char* filepath, int32_t
m_status = Error;
return;
}
- FILE* f = fopen(filepath, "rb");
- open(f, filepath, buffersize);
+ file = fopen(filepath, "rb");
+ open(file, filepath, buffersize);
}
SkippingFileInputStream2::SkippingFileInputStream2(FILE* file, const char* filepath,
int32_t buffersize) {
--
1.8.4.2
|