2
0
Эх сурвалжийг харах

nats: declare variable at beginning of function

Daniel-Constantin Mierla 2 жил өмнө
parent
commit
d315eb26c1

+ 2 - 1
src/modules/nats/nats_mod.c

@@ -530,6 +530,7 @@ int nats_cleanup_init_servers()
 
 
 int nats_cleanup_connection(nats_connection_ptr c)
 int nats_cleanup_connection(nats_connection_ptr c)
 {
 {
+	int s;
 	if(c->conn != NULL) {
 	if(c->conn != NULL) {
 		natsConnection_Close(c->conn);
 		natsConnection_Close(c->conn);
 		natsConnection_Destroy(c->conn);
 		natsConnection_Destroy(c->conn);
@@ -537,7 +538,7 @@ int nats_cleanup_connection(nats_connection_ptr c)
 	if(c->opts != NULL) {
 	if(c->opts != NULL) {
 		natsOptions_Destroy(c->opts);
 		natsOptions_Destroy(c->opts);
 	}
 	}
-	for(int s = 0; s < NATS_MAX_SERVERS; s++) {
+	for(s = 0; s < NATS_MAX_SERVERS; s++) {
 		if(c->servers[s]) {
 		if(c->servers[s]) {
 			shm_free(c->servers[s]);
 			shm_free(c->servers[s]);
 		}
 		}