Browse Source

Bugfix: RPC: Defer allocation of apisock until after we check for --api-listen

Luke Dashjr 12 years ago
parent
commit
55dfaa313a
1 changed files with 3 additions and 3 deletions
  1. 3 3
      api.c

+ 3 - 3
api.c

@@ -3974,14 +3974,14 @@ void api(int api_thr_id)
 
 	SOCKETTYPE *apisock;
 
-	apisock = malloc(sizeof(*apisock));
-	*apisock = INVSOCK;
-
 	if (!opt_api_listen) {
 		applog(LOG_DEBUG, "API not running%s", UNAVAILABLE);
 		return;
 	}
 
+	apisock = malloc(sizeof(*apisock));
+	*apisock = INVSOCK;
+
 	io_data = sock_io_new();
 
 	mutex_init(&quit_restart_lock);