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 70949b91506c3d39061c62645eb0d4de4477e2dd..f2ba491d93adbc41d8773eedf77b4564f90ece13 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");