summaryrefslogtreecommitdiff
path: root/xmlstarlet-xml_depyx.c.diff
blob: e84661adb3ee4ff81ff2339954375e839ce6e47d (plain)
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
--- src/xml_depyx.c.orig	2011-02-17 09:53:27.000000000 +0100
+++ src/xml_depyx.c	2011-02-17 10:00:13.000000000 +0100
@@ -115,6 +115,7 @@
 {
    static char line[INSZ];
    FILE *in = stdin;
+   int opened_in = 0;
 
    if (strcmp(file, "-"))
    {
@@ -124,6 +125,7 @@
           fprintf(stderr, "error: could not open: %s\n", file);
           exit(EXIT_BAD_FILE);
        }
+       opened_in = 1;
    }
    
    while (!feof(in))
@@ -216,6 +218,11 @@
        }
    }
 
+   if (opened_in)
+   {
+       fclose(in);
+   }
+
    return EXIT_SUCCESS;
 }