|  | @@ -509,11 +509,8 @@ static esp_err_t actrls_init_json(const char *profile_name, bool create) {
 | 
	
		
			
				|  |  |  	const cJSON *button;
 | 
	
		
			
				|  |  |  	
 | 
	
		
			
				|  |  |  	if (!profile_name) return ESP_OK;
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | -	config = config_alloc_get_str(profile_name, NULL, CONFIG_AUDIO_CONTROLS);
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | -	if (!config) return ESP_FAIL;
 | 
	
		
			
				|  |  | -	else if (!*config) return ESP_OK; 
 | 
	
		
			
				|  |  | +	if ((config = config_alloc_get_str(profile_name, NULL, CONFIG_AUDIO_CONTROLS)) == NULL) return ESP_FAIL;
 | 
	
		
			
				|  |  | +	if (!*config) goto exit;
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  |  	ESP_LOGD(TAG,"Parsing JSON structure %s", config);
 | 
	
		
			
				|  |  |  	cJSON *buttons = cJSON_Parse(config);
 | 
	
	
		
			
				|  | @@ -528,8 +525,8 @@ static esp_err_t actrls_init_json(const char *profile_name, bool create) {
 | 
	
		
			
				|  |  |  			if(!cur_config) {
 | 
	
		
			
				|  |  |  				ESP_LOGE(TAG,"Config buffer was empty. ");
 | 
	
		
			
				|  |  |  				cJSON_Delete(buttons);
 | 
	
		
			
				|  |  | -				free(config);
 | 
	
		
			
				|  |  | -				return ESP_FAIL;
 | 
	
		
			
				|  |  | +				err = ESP_FAIL;
 | 
	
		
			
				|  |  | +				goto exit;
 | 
	
		
			
				|  |  |  			}
 | 
	
		
			
				|  |  |  			ESP_LOGD(TAG,"Processing button definitions. ");
 | 
	
		
			
				|  |  |  			cJSON_ArrayForEach(button, buttons){
 | 
	
	
		
			
				|  | @@ -560,6 +557,7 @@ static esp_err_t actrls_init_json(const char *profile_name, bool create) {
 | 
	
		
			
				|  |  |  	// the last init that completes will assigh the first json config object found, which will match
 | 
	
		
			
				|  |  |  	// the default config from nvs.
 | 
	
		
			
				|  |  |  	json_config = config_root;
 | 
	
		
			
				|  |  | +exit:	
 | 
	
		
			
				|  |  |  	free(config);
 | 
	
		
			
				|  |  |  	return err;
 | 
	
		
			
				|  |  |  }
 |