Browse Source

Bugfix: SSM: decref parsed JSON when done with it

Luke Dashjr 11 years ago
parent
commit
f8002e6a08
1 changed files with 4 additions and 1 deletions
  1. 4 1
      driver-stratum.c

+ 4 - 1
driver-stratum.c

@@ -494,6 +494,8 @@ bool stratumsrv_process_line(struct bufferevent * const bev, const char * const
 	if (!method)
 	{
 		applog(LOG_ERR, "SSM: JSON missing method: %s", ln);
+errout:
+		json_decref(json);
 		return false;
 	}
 	
@@ -501,7 +503,7 @@ bool stratumsrv_process_line(struct bufferevent * const bev, const char * const
 	if (!params)
 	{
 		applog(LOG_ERR, "SSM: JSON missing params: %s", ln);
-		return false;
+		goto errout;
 	}
 	
 	applog(LOG_DEBUG, "SSM: RECV: %s", ln);
@@ -524,6 +526,7 @@ bool stratumsrv_process_line(struct bufferevent * const bev, const char * const
 		_stratumsrv_failure(bev, idstr, -3, "Method not supported");
 	
 	free(idstr);
+	json_decref(json);
 	return true;
 }