chiark / gitweb /
fix an uninit'd variable
[chiark-utils.git] / cprogs / xacpi-simple.c
index 70949b9..f2ba491 100644 (file)
@@ -357,7 +357,7 @@ static double total_##f;
   ALL_ACCUMULATE_FIELDS(Q_VAR)
 
 static void acquiredata(void) {
-  DIR *di;
+  DIR *di = 0;
   struct dirent *de;
   int r;
   
@@ -427,7 +427,7 @@ ALL_PLAIN_ACCUMULATE_FIELDS(Q_ACCUMULATE_PLAIN)
 
       
   }
-  closedir(di);
+  if (di) closedir(di);
 
   if (debug) {
     printf("TOTAL:\n");