@henningw commented on this pull request.

The stale flag got now removed from the bot. I think this is a useful addition, even if it changes the default behaviour of the module. For people want the previous behavior back, they can easily configure 127.0.0.1 manually. I did a quick review, just added two comments regarding memory management in mod_init. Other developers want probably also review it, as its a larger patch.


In src/modules/topoh/topoh_mod.c:

> +		if(th_build_via_prefix(&th_via_prefix, &th_ip))
+		{
+			goto error;
+		}
+		if(th_build_uri_prefix(&th_uri_prefix, &th_ip))
+		{
+			goto error;
+		}
+	} else {
+		th_socket_hash_table = pkg_malloc(sizeof(struct str_hash_table));
+		if(th_socket_hash_table == NULL){
+			PKG_MEM_ERROR_FMT("th_socket_hash_table\n");
+			goto error;
+		}
+		if(str_hash_alloc(th_socket_hash_table, TH_HT_SIZE))
+			goto error;

We probably should free the th_socket_hash_table in error block.


In src/modules/topoh/topoh_mod.c:

> +		}
+	} else {
+		th_socket_hash_table = pkg_malloc(sizeof(struct str_hash_table));
+		if(th_socket_hash_table == NULL){
+			PKG_MEM_ERROR_FMT("th_socket_hash_table\n");
+			goto error;
+		}
+		if(str_hash_alloc(th_socket_hash_table, TH_HT_SIZE))
+			goto error;
+
+		str_hash_init(th_socket_hash_table);
+		if(th_parse_socket_list(*get_sock_info_list(PROTO_UDP)) != 0 ||
+		   th_parse_socket_list(*get_sock_info_list(PROTO_TCP)) != 0 ||
+		   th_parse_socket_list(*get_sock_info_list(PROTO_TLS)) != 0 ||
+		   th_parse_socket_list(*get_sock_info_list(PROTO_SCTP)) !=0)
+			goto error;

We should probably free the th_socket_hash_table and the str_hash_alloc list in error block.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <kamailio/kamailio/pull/3341/review/1727280717@github.com>