Skip to contentSkip to conversation

Close stream in 'I' switch handling

PATCH New Eric Sandeen 1 participant 1 message Dec 16, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 4/10 Close stream in 'I' switch handling

The file containing the list of devices was never closed after processing was complete.

---

blktrace.c +6 -2
index 848250d..5f74ef2 100644
@@ -2076,9 +2076,13 @@ static int handle_args(int argc, char *argv[])
 				return 1;
 			}
 
-			while (fscanf(ifp, "%s\n", dev_line) = 1)
-				if (add_devpath(dev_line) != 0)
+			while (fscanf(ifp, "%s\n", dev_line) = 1) {
+				if (add_devpath(dev_line) != 0) {
+					fclose(ifp);
 					return 1;
+				}
+			}
+			fclose(ifp);
 			break;
 		}