chiark / gitweb /
fix an uninit'd variable
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 6 Jun 2012 00:50:42 +0000 (01:50 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 6 Jun 2012 00:50:42 +0000 (01:50 +0100)
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");