Browse Source

Merge pull request #768 from isghe/fix-warning-checking-address-of-array

fix warning: checking address of array
Luke Dashjr 7 years ago
parent
commit
63fe36a23d
1 changed files with 4 additions and 2 deletions
  1. 4 2
      adl.c

+ 4 - 2
adl.c

@@ -385,9 +385,11 @@ void init_adl(int nDevs)
 		}
 
 		applog(LOG_INFO, "GPU %d %s hardware monitoring enabled", gpu, lpInfo[i].strAdapterName);
-		if (gpus[gpu].name)
+		if (gpus[gpu].name) {
 			free((void*)gpus[gpu].name);
-		if (lpInfo[i].strAdapterName)
+			gpus[gpu].name = NULL;
+		}
+		if (lpInfo[i].strAdapterName[0])
 			gpus[gpu].name = trimmed_strdup(lpInfo[i].strAdapterName);
 		data->has_adl = true;
 		/* Flag adl as active if any card is successfully activated */