diff --git a/src/mod_netconf.c b/src/mod_netconf.c
index e38ebea..1412f12 100644
--- a/src/mod_netconf.c
+++ b/src/mod_netconf.c
@@ -229,8 +229,7 @@
 	} else {
 		DEBUG("error calback: nonempty error list");
 		pthread_mutex_lock(&json_lock);
-		array = json_object_object_get(err_reply, "errors");
-		if (array != NULL) {
+		if (json_object_object_get_ex(err_reply, "errors", &array) == TRUE) {
 			if (message != NULL) {
 				json_object_array_add(array, json_object_new_string(message));
 			}
@@ -247,6 +246,7 @@
 void prepare_status_message(struct session_with_mutex *s, struct nc_session *session)
 {
 	json_object *json_obj = NULL;
+	json_object *js_tmp = NULL;
 	char *old_sid = NULL;
 	const char *j_old_sid = NULL;
 	const char *cpbltstr;
@@ -261,11 +261,14 @@
 	if (s->hello_message != NULL) {
 		DEBUG("clean previous hello message");
 		//json_object_put(s->hello_message);
-		j_old_sid = json_object_get_string(json_object_object_get(s->hello_message, "sid"));
-		if (j_old_sid != NULL) {
-			old_sid = strdup(j_old_sid);
+		if (json_object_object_get_ex(s->hello_message, "sid", &js_tmp) == TRUE) {
+			j_old_sid = json_object_get_string(js_tmp);
+			if (j_old_sid != NULL) {
+				old_sid = strdup(j_old_sid);
+			}
+			json_object_put(s->hello_message);
+			json_object_put(js_tmp);
 		}
-		json_object_put(s->hello_message);
 		s->hello_message = NULL;
 	}
 	s->hello_message = json_object_get(json_object_new_object());
@@ -1116,12 +1119,23 @@
 	return reply;
 }
 
+char *get_param_string(json_object *data, const char *name)
+{
+	json_object *js_tmp = NULL;
+	char *res = NULL;
+	if (json_object_object_get_ex(data, name, &js_tmp) == TRUE) {
+		res = strdup(json_object_get_string(js_tmp));
+		json_object_put(js_tmp);
+	}
+	return res;
+}
+
 json_object *handle_op_connect(apr_pool_t *pool, json_object *request)
 {
-	const char *host = NULL;
-	const char *port = NULL;
-	const char *user = NULL;
-	const char *pass = NULL;
+	char *host = NULL;
+	char *port = NULL;
+	char *user = NULL;
+	char *pass = NULL;
 	json_object *capabilities = NULL;
 	json_object *reply = NULL;
 	char *session_key_hash = NULL;
@@ -1130,20 +1144,24 @@
 
 	DEBUG("Request: Connect");
 	pthread_mutex_lock(&json_lock);
-	host = json_object_get_string(json_object_object_get((json_object *) request, "host"));
-	port = json_object_get_string(json_object_object_get((json_object *) request, "port"));
-	user = json_object_get_string(json_object_object_get((json_object *) request, "user"));
-	pass = json_object_get_string(json_object_object_get((json_object *) request, "pass"));
 
-	capabilities = json_object_object_get((json_object *) request, "capabilities");
-	if ((capabilities != NULL) && ((len = json_object_array_length(capabilities)) > 0)) {
-		cpblts = nc_cpblts_new(NULL);
-		for (i=0; i<len; i++) {
-			nc_cpblts_add(cpblts, json_object_get_string(json_object_array_get_idx(capabilities, i)));
+	host = get_param_string(request, "host");
+	port = get_param_string(request, "port");
+	user = get_param_string(request, "user");
+	pass = get_param_string(request, "pass");
+
+	if (json_object_object_get_ex(request, "capabilities", &capabilities) == TRUE) {
+		if ((capabilities != NULL) && ((len = json_object_array_length(capabilities)) > 0)) {
+			cpblts = nc_cpblts_new(NULL);
+			for (i=0; i<len; i++) {
+				nc_cpblts_add(cpblts, json_object_get_string(json_object_array_get_idx(capabilities, i)));
+			}
+		} else {
+			DEBUG("no capabilities specified");
 		}
-	} else {
-		DEBUG("no capabilities specified");
+		json_object_put(capabilities);
 	}
+
 	pthread_mutex_unlock(&json_lock);
 
 	DEBUG("host: %s, port: %s, user: %s", host, port, user);
@@ -1181,20 +1199,25 @@
 
 		free(session_key_hash);
 	}
+	memset(pass, 0, strlen(pass));
 	pthread_mutex_unlock(&json_lock);
+	CHECK_AND_FREE(host);
+	CHECK_AND_FREE(user);
+	CHECK_AND_FREE(port);
+	CHECK_AND_FREE(pass);
 	return reply;
 }
 
 json_object *handle_op_get(apr_pool_t *pool, json_object *request, const char *session_key)
 {
-	const char *filter = NULL;
+	char *filter = NULL;
 	char *data = NULL;
 	json_object *reply = NULL;
 
 	DEBUG("Request: get (session %s)", session_key);
 
 	pthread_mutex_lock(&json_lock);
-	filter = json_object_get_string(json_object_object_get(request, "filter"));
+	filter = get_param_string(request, "filter");
 	pthread_mutex_unlock(&json_lock);
 
 	if ((data = netconf_get(session_key, filter, &reply)) == NULL) {
@@ -1209,22 +1232,25 @@
 json_object *handle_op_getconfig(apr_pool_t *pool, json_object *request, const char *session_key)
 {
 	NC_DATASTORE ds_type_s = -1;
-	const char *filter = NULL;
+	char *filter = NULL;
 	char *data = NULL;
-	const char *source = NULL;
+	char *source = NULL;
 	json_object *reply = NULL;
 
 	DEBUG("Request: get-config (session %s)", session_key);
 
 	pthread_mutex_lock(&json_lock);
-	filter = json_object_get_string(json_object_object_get(request, "filter"));
+	filter = get_param_string(request, "filter");
 
-	if ((source = json_object_get_string(json_object_object_get(request, "source"))) != NULL) {
+	source = get_param_string(request, "source");
+	if (source != NULL) {
 		ds_type_s = parse_datastore(source);
 	}
 	pthread_mutex_unlock(&json_lock);
+
 	if (ds_type_s == -1) {
-		return create_error("Invalid source repository type requested.");
+		reply = create_error("Invalid source repository type requested.");
+		goto finalize;
 	}
 
 	if ((data = netconf_getconfig(session_key, ds_type_s, filter, &reply)) == NULL) {
@@ -1233,26 +1259,30 @@
 		reply = create_data(data);
 		free(data);
 	}
+finalize:
+	CHECK_AND_FREE(filter);
+	CHECK_AND_FREE(source);
 	return reply;
 }
 
 json_object *handle_op_getschema(apr_pool_t *pool, json_object *request, const char *session_key)
 {
 	char *data = NULL;
-	const char *identifier = NULL;
-	const char *version = NULL;
-	const char *format = NULL;
+	char *identifier = NULL;
+	char *version = NULL;
+	char *format = NULL;
 	json_object *reply = NULL;
 
 	DEBUG("Request: get-schema (session %s)", session_key);
 	pthread_mutex_lock(&json_lock);
-	identifier = json_object_get_string(json_object_object_get(request, "identifier"));
-	version = json_object_get_string(json_object_object_get(request, "version"));
-	format = json_object_get_string(json_object_object_get(request, "format"));
+	identifier = get_param_string(request, "identifier");
+	version = get_param_string(request, "version");
+	format = get_param_string(request, "format");
 	pthread_mutex_unlock(&json_lock);
 
 	if (identifier == NULL) {
-		return create_error("No identifier for get-schema supplied.");
+		reply = create_error("No identifier for get-schema supplied.");
+		goto finalize;
 	}
 
 	DEBUG("get-schema(version: %s, format: %s)", version, format);
@@ -1262,6 +1292,10 @@
 		reply = create_data(data);
 		free(data);
 	}
+finalize:
+	CHECK_AND_FREE(identifier);
+	CHECK_AND_FREE(version);
+	CHECK_AND_FREE(format);
 	return reply;
 }
 
@@ -1272,32 +1306,35 @@
 	NC_EDIT_DEFOP_TYPE defop_type = NC_EDIT_DEFOP_NOTSET;
 	NC_EDIT_ERROPT_TYPE erropt_type = 0;
 	NC_EDIT_TESTOPT_TYPE testopt_type = NC_EDIT_TESTOPT_TESTSET;
-	const char *defop = NULL;
-	const char *erropt = NULL;
-	const char *config = NULL;
-	const char *source = NULL;
-	const char *target = NULL;
-	const char *testopt = NULL;
+	char *defop = NULL;
+	char *erropt = NULL;
+	char *config = NULL;
+	char *source = NULL;
+	char *target = NULL;
+	char *testopt = NULL;
 	json_object *reply = NULL;
 
 	DEBUG("Request: edit-config (session %s)", session_key);
 
 	pthread_mutex_lock(&json_lock);
-	defop = json_object_get_string(json_object_object_get(request, "default-operation"));
-	erropt = json_object_get_string(json_object_object_get(request, "error-option"));
 	/* get parameters */
-	if ((target = json_object_get_string(json_object_object_get(request, "target"))) != NULL) {
+	defop = get_param_string(request, "default-operation");
+	erropt = get_param_string(request, "error-option");
+	target = get_param_string(request, "target");
+	source = get_param_string(request, "source");
+	config = get_param_string(request, "config");
+	testopt = get_param_string(request, "test-option");
+	pthread_mutex_unlock(&json_lock);
+
+	if (target != NULL) {
 		ds_type_t = parse_datastore(target);
 	}
-	if ((source = json_object_get_string(json_object_object_get(request, "source"))) != NULL) {
+	if (source != NULL) {
 		ds_type_s = parse_datastore(source);
 	} else {
 		/* source is optional, default value is config */
 		ds_type_s = NC_DATASTORE_CONFIG;
 	}
-	config = json_object_get_string(json_object_object_get(request, "config"));
-	testopt = json_object_get_string(json_object_object_get(request, "test-option"));
-	pthread_mutex_unlock(&json_lock);
 
 	if (defop != NULL) {
 		if (strcmp(defop, "merge") == 0) {
@@ -1307,7 +1344,8 @@
 		} else if (strcmp(defop, "none") == 0) {
 			defop_type = NC_EDIT_DEFOP_NONE;
 		} else {
-			return create_error("Invalid default-operation parameter.");
+			reply = create_error("Invalid default-operation parameter.");
+			goto finalize;
 		}
 	} else {
 		defop_type = NC_EDIT_DEFOP_NOTSET;
@@ -1321,18 +1359,21 @@
 		} else if (strcmp(erropt, "rollback-on-error") == 0) {
 			erropt_type = NC_EDIT_ERROPT_ROLLBACK;
 		} else {
-			return create_error("Invalid error-option parameter.");
+			reply = create_error("Invalid error-option parameter.");
+			goto finalize;
 		}
 	} else {
 		erropt_type = 0;
 	}
 
 	if (ds_type_t == -1) {
-		return create_error("Invalid target repository type requested.");
+		reply = create_error("Invalid target repository type requested.");
+		goto finalize;
 	}
 	if (ds_type_s == NC_DATASTORE_CONFIG) {
 		if (config == NULL) {
-			return create_error("Invalid config data parameter.");
+			reply = create_error("Invalid config data parameter.");
+			goto finalize;
 		}
 	} else if (ds_type_s == NC_DATASTORE_URL){
 		if (config == NULL) {
@@ -1349,7 +1390,13 @@
 	reply = netconf_editconfig(session_key, ds_type_s, ds_type_t, defop_type, erropt_type, testopt_type, config);
 
 	CHECK_ERR_SET_REPLY
-
+finalize:
+	CHECK_AND_FREE(defop);
+	CHECK_AND_FREE(erropt);
+	CHECK_AND_FREE(config);
+	CHECK_AND_FREE(source);
+	CHECK_AND_FREE(target);
+	CHECK_AND_FREE(testopt);
 	return reply;
 }
 
@@ -1357,46 +1404,50 @@
 {
 	NC_DATASTORE ds_type_s = -1;
 	NC_DATASTORE ds_type_t = -1;
-	const char *config = NULL;
-	const char *target = NULL;
-	const char *source = NULL;
-	const char *uri_src = NULL;
-	const char *uri_trg = NULL;
+	char *config = NULL;
+	char *target = NULL;
+	char *source = NULL;
+	char *uri_src = NULL;
+	char *uri_trg = NULL;
 
 	json_object *reply = NULL;
 
 	DEBUG("Request: copy-config (session %s)", session_key);
 
-	pthread_mutex_lock(&json_lock);
 	/* get parameters */
-	if ((target = json_object_get_string(json_object_object_get(request, "target"))) != NULL) {
-		ds_type_t = parse_datastore(target);
-	}
-	if ((source = json_object_get_string(json_object_object_get(request, "source"))) != NULL) {
-		ds_type_s = parse_datastore(source);
-	}
-	config = json_object_get_string(json_object_object_get(request, "config"));
-	uri_src = json_object_get_string(json_object_object_get(request, "uri-source"));
-	uri_trg = json_object_get_string(json_object_object_get(request, "uri-target"));
+	pthread_mutex_lock(&json_lock);
+	target = get_param_string(request, "target");
+	source = get_param_string(request, "source");
+	config = get_param_string(request, "config");
+	uri_src = get_param_string(request, "uri-source");
+	uri_trg = get_param_string(request, "uri-target");
 	pthread_mutex_unlock(&json_lock);
 
-	if (source == NULL) {
-		/* no explicit source specified -> use config data */
+	if (target != NULL) {
+		ds_type_t = parse_datastore(target);
+	}
+	if (source != NULL) {
+		ds_type_s = parse_datastore(source);
+	} else {
+		/* source == NULL *//* no explicit source specified -> use config data */
 		ds_type_s = NC_DATASTORE_CONFIG;
-	} else if (ds_type_s == -1) {
+	}
+	if (ds_type_s == -1) {
 		/* source datastore specified, but it is invalid */
-		return create_error("Invalid source repository type requested.");
+		reply = create_error("Invalid source repository type requested.");
+		goto finalize;
 	}
 
 	if (ds_type_t == -1) {
 		/* invalid target datastore specified */
-		return create_error("Invalid target repository type requested.");
+		reply = create_error("Invalid target repository type requested.");
+		goto finalize;
 	}
 
 	/* source can be missing when config is given */
 	if (source == NULL && config == NULL) {
 		reply = create_error("invalid input parameters - source and config is required.");
-		return reply;
+		goto finalize;
 	}
 
 	if (ds_type_s == NC_DATASTORE_URL) {
@@ -1413,19 +1464,26 @@
 
 	CHECK_ERR_SET_REPLY
 
+finalize:
+	CHECK_AND_FREE(config);
+	CHECK_AND_FREE(target);
+	CHECK_AND_FREE(source);
+	CHECK_AND_FREE(uri_src);
+	CHECK_AND_FREE(uri_trg);
+
 	return reply;
 }
 
 json_object *handle_op_generic(apr_pool_t *pool, json_object *request, const char *session_key)
 {
 	json_object *reply = NULL;
-	const char *config = NULL;
+	char *config = NULL;
 	char *data = NULL;
 
 	DEBUG("Request: generic request for session %s", session_key);
 
 	pthread_mutex_lock(&json_lock);
-	config = json_object_get_string(json_object_object_get(request, "content"));
+	config = get_param_string(request, "content");
 	pthread_mutex_unlock(&json_lock);
 
 	reply = netconf_generic(session_key, config, &data);
@@ -1446,6 +1504,7 @@
 			free(data);
 		}
 	}
+	CHECK_AND_FREE(config);
 	return reply;
 }
 
@@ -1465,22 +1524,25 @@
 json_object *handle_op_kill(apr_pool_t *pool, json_object *request, const char *session_key)
 {
 	json_object *reply = NULL;
-	const char *sid = NULL;
+	char *sid = NULL;
 
 	DEBUG("Request: kill-session, session %s", session_key);
 
 	pthread_mutex_lock(&json_lock);
-	sid = json_object_get_string(json_object_object_get(request, "session-id"));
+	sid = get_param_string(request, "session-id");
 	pthread_mutex_unlock(&json_lock);
 
 	if (sid == NULL) {
-		return create_error("Missing session-id parameter.");
+		reply = create_error("Missing session-id parameter.");
+		goto finalize;
 	}
 
 	reply = netconf_killsession(session_key, sid);
 
 	CHECK_ERR_SET_REPLY
 
+finalize:
+	CHECK_AND_FREE(sid);
 	return reply;
 }
 
@@ -1497,7 +1559,7 @@
 		return NULL;
 	}
 
-	locked_session = (struct session_with_mutex *)apr_hash_get(netconf_sessions_list, session_key, APR_HASH_KEY_STRING);
+	locked_session = (struct session_with_mutex *) apr_hash_get(netconf_sessions_list, session_key, APR_HASH_KEY_STRING);
 	if ((locked_session != NULL) && (locked_session->hello_message != NULL)) {
 		DEBUG("LOCK mutex %s", __func__);
 		pthread_mutex_lock(&locked_session->lock);
@@ -1543,7 +1605,7 @@
 		DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
 	}
 
-	locked_session = (struct session_with_mutex *)apr_hash_get(netconf_sessions_list, session_key, APR_HASH_KEY_STRING);
+	locked_session = (struct session_with_mutex *) apr_hash_get(netconf_sessions_list, session_key, APR_HASH_KEY_STRING);
 	if (locked_session != NULL) {
 		DEBUG("LOCK mutex %s", __func__);
 		pthread_mutex_lock(&locked_session->lock);
@@ -1594,20 +1656,28 @@
 json_object *handle_op_ntfgethistory(apr_pool_t *pool, json_object *request, const char *session_key)
 {
 	json_object *reply = NULL;
-	const char *sid = NULL;
+	json_object *js_tmp = NULL;
+	char *sid = NULL;
 	struct session_with_mutex *locked_session = NULL;
 	struct nc_session *temp_session = NULL;
 	nc_rpc *rpc = NULL;
 	time_t start = 0;
 	time_t stop = 0;
-	int64_t from, to;
+	int64_t from = 0, to = 0;
 
 	DEBUG("Request: get notification history, session %s", session_key);
 
 	pthread_mutex_lock(&json_lock);
-	sid = json_object_get_string(json_object_object_get(request, "session"));
-	from = json_object_get_int64(json_object_object_get(request, "from"));
-	to = json_object_get_int64(json_object_object_get(request, "to"));
+	sid = get_param_string(request, "session");
+
+	if (json_object_object_get_ex(request, "from", &js_tmp) == TRUE) {
+		from = json_object_get_int64(js_tmp);
+		json_object_put(js_tmp);
+	}
+	if (json_object_object_get_ex(request, "to", &js_tmp) == TRUE) {
+		to = json_object_get_int64(js_tmp);
+		json_object_put(js_tmp);
+	}
 	pthread_mutex_unlock(&json_lock);
 
 	start = time(NULL) + from;
@@ -1616,13 +1686,15 @@
 	DEBUG("notification history interval %li %li", (long int) from, (long int) to);
 
 	if (sid == NULL) {
-		return create_error("Missing session parameter.");
+		reply = create_error("Missing session parameter.");
+		goto finalize;
 	}
 
 	DEBUG("LOCK wrlock %s", __func__);
 	if (pthread_rwlock_rdlock(&session_lock) != 0) {
 		DEBUG("Error while unlocking rwlock: %d (%s)", errno, strerror(errno));
-		return NULL;
+		reply = create_error("Internal lock failed.");
+		goto finalize;
 	}
 
 	locked_session = (struct session_with_mutex *)apr_hash_get(netconf_sessions_list, session_key, APR_HASH_KEY_STRING);
@@ -1641,7 +1713,8 @@
 				DEBUG("UNLOCK mutex %s", __func__);
 				pthread_mutex_unlock(&locked_session->lock);
 				DEBUG("notifications: creating an rpc request failed.");
-				return create_error("notifications: creating an rpc request failed.");
+				reply = create_error("notifications: creating an rpc request failed.");
+				goto finalize;
 			}
 
 			DEBUG("Send NC subscribe.");
@@ -1651,7 +1724,8 @@
 				DEBUG("UNLOCK mutex %s", __func__);
 				pthread_mutex_unlock(&locked_session->lock);
 				DEBUG("Subscription RPC failed.");
-				return res;
+				reply = res;
+				goto finalize;
 			}
 			rpc = NULL; /* just note that rpc is already freed by send_recv_process() */
 
@@ -1693,29 +1767,32 @@
 		reply = create_error("Invalid session identifier.");
 	}
 
+finalize:
+	CHECK_AND_FREE(sid);
 	return reply;
 }
 
 json_object *handle_op_validate(apr_pool_t *pool, json_object *request, const char *session_key)
 {
 	json_object *reply = NULL;
-	const char *sid = NULL;
-	const char *target = NULL;
-	const char *url = NULL;
+	char *sid = NULL;
+	char *target = NULL;
+	char *url = NULL;
 	nc_rpc *rpc = NULL;
 	NC_DATASTORE target_ds;
 
 	DEBUG("Request: validate datastore, session %s", session_key);
 
 	pthread_mutex_lock(&json_lock);
-	sid = json_object_get_string(json_object_object_get(request, "session"));
-	target = json_object_get_string(json_object_object_get(request, "target"));
-	url = json_object_get_string(json_object_object_get(request, "url"));
+	sid = get_param_string(request, "session");
+	target = get_param_string(request, "target");
+	url = get_param_string(request, "url");
 	pthread_mutex_unlock(&json_lock);
 
 
 	if ((sid == NULL) || (target == NULL)) {
-		return create_error("Missing session parameter.");
+		reply = create_error("Missing session parameter.");
+		goto finalize;
 	}
 
 	/* validation */
@@ -1731,7 +1808,7 @@
 	if (rpc == NULL) {
 		DEBUG("mod_netconf: creating rpc request failed");
 		reply = create_error("Creation of RPC request failed.");
-		return reply;
+		goto finalize;
 	}
 
 	DEBUG("Request: validate datastore");
@@ -1745,7 +1822,10 @@
 		}
 	}
 	nc_rpc_free (rpc);
-
+finalize:
+	CHECK_AND_FREE(sid);
+	CHECK_AND_FREE(target);
+	CHECK_AND_FREE(url);
 	return reply;
 }
 
@@ -1755,13 +1835,14 @@
 	struct pollfd fds;
 	json_object *request = NULL;
 	json_object *reply = NULL;
-	int operation;
+	json_object *js_tmp = NULL;
+	int operation = (-1);
+	NC_DATASTORE ds_type_t = -1;
 	int status = 0;
 	const char *msgtext;
-	const char *session_key;
-	const char *target = NULL;
-	const char *url = NULL;
-	NC_DATASTORE ds_type_t = -1;
+	char *session_key = NULL;
+	char *target = NULL;
+	char *url = NULL;
 	char *chunked_out_msg = NULL;
 	apr_pool_t * pool = ((struct pass_to_thread*)arg)->pool;
 	//server_rec * server = ((struct pass_to_thread*)arg)->server;
@@ -1819,9 +1900,17 @@
 				continue;
 			}
 
-			operation = json_object_get_int(json_object_object_get(request, "type"));
-			session_key = json_object_get_string(json_object_object_get(request, "session"));
+			session_key = get_param_string(request, "session");
+			if (json_object_object_get_ex(request, "type", &js_tmp) == TRUE) {
+				operation = json_object_get_int(js_tmp);
+				json_object_put(js_tmp);
+				js_tmp = NULL;
+			}
 			pthread_mutex_unlock(&json_lock);
+			if (operation == -1) {
+				reply = create_error("Missing operation type form frontend.");
+				goto send_reply;
+			}
 
 			DEBUG("operation %d session_key %s.", operation, session_key);
 			/* DO NOT FREE session_key HERE, IT IS PART OF REQUEST */
@@ -1878,10 +1967,11 @@
 			case MSG_UNLOCK:
 				/* get parameters */
 				pthread_mutex_lock(&json_lock);
-				if ((target = json_object_get_string(json_object_object_get(request, "target"))) != NULL) {
+				target = get_param_string(request, "target");
+				pthread_mutex_unlock(&json_lock);
+				if (target != NULL) {
 					ds_type_t = parse_datastore(target);
 				}
-				pthread_mutex_unlock(&json_lock);
 
 				if (ds_type_t == -1) {
 					reply = create_error("Invalid target repository type requested.");
@@ -1891,7 +1981,7 @@
 				case MSG_DELETECONFIG:
 					DEBUG("Request: delete-config (session %s)", session_key);
 					pthread_mutex_lock(&json_lock);
-					url = json_object_get_string(json_object_object_get(request, "url"));
+					url = get_param_string(request, "url");
 					pthread_mutex_unlock(&json_lock);
 					reply = netconf_deleteconfig(session_key, ds_type_t, url);
 					break;
@@ -1910,10 +2000,7 @@
 
 				CHECK_ERR_SET_REPLY
 				if (reply == NULL) {
-					pthread_mutex_lock(&json_lock);
-					reply = json_object_new_object();
-					json_object_object_add(reply, "type", json_object_new_int(REPLY_OK));
-					pthread_mutex_unlock(&json_lock);
+					reply = create_ok();
 				}
 				break;
 			case MSG_KILL:
@@ -1942,10 +2029,23 @@
 				reply = create_error("Operation not supported.");
 				break;
 			}
+			/* free parameters */
+			CHECK_AND_FREE(session_key);
+			CHECK_AND_FREE(url);
+			CHECK_AND_FREE(target);
+			request = NULL;
+			operation = (-1);
+			ds_type_t = (-1);
+
 			DEBUG("Clean request json object.");
 			pthread_mutex_lock(&json_lock);
-			json_object_put(request);
+			if (request != NULL) {
+				json_object_put(request);
+			}
 			DEBUG("Send reply json object.");
+
+
+send_reply:
 			/* send reply to caller */
 			if (reply != NULL) {
 				msgtext = json_object_to_json_string(reply);
@@ -1965,7 +2065,7 @@
 				json_object_put(reply);
 				reply = NULL;
 				DEBUG("Clean message buffer.");
-				free(chunked_out_msg);
+				CHECK_AND_FREE(chunked_out_msg);
 				chunked_out_msg = NULL;
 				if (buffer != NULL) {
 					free(buffer);
