[hprof-conv] Check for NULL before closing descriptors
Else hprof-conf fails with a segfault. Fixing this will help add a smoke
test for the Windows hprof-conv.
Test: hprof-conv.exe under wine
Change-Id: I0f19932ece26f0171e9c01c63536d71c28adb97f
diff --git a/tools/hprof-conv/HprofConv.c b/tools/hprof-conv/HprofConv.c
index a69440c..cc90176 100644
--- a/tools/hprof-conv/HprofConv.c
+++ b/tools/hprof-conv/HprofConv.c
@@ -764,9 +764,9 @@
res = 2;
finish:
- if (in != stdin)
+ if (in != stdin && in != NULL)
fclose(in);
- if (out != stdout)
+ if (out != stdout && out != NULL)
fclose(out);
return res;
}