weixin_39743064
weixin_39743064
2021-01-12 03:56

Memory allocation improvements

Hi! I've made some general fixes and improvements to Janus code. The changes were the following:

  • wrong usage of getsockname();
  • unneeded or redundant use of g_malloc0() and memset() functions, either because they were used together, or the allocated memory is for a struct that has all members set after the allocation, or a memcpy() is done after the allocation;
  • unneeded memory allocations checking, as GLib's g_malloc() and others abort the program on failure;
  • some unneeded run-time checking of pointers to decide which of g_malloc() and g_realloc() functions should be used - g_realloc(NULL, size) is equivalent to g_malloc(size);
  • allocation bug on transports/janus_http.c where calloc() were substituted incorrectly with a g_malloc0();
  • a possible memory leak at janus_text2pcap_create();
  • an incorrect comment header for janus_plugin_result_destroy(); and
  • removed castings from memory allocations.

Please refer to the commits' comments for more details. Thanks!

该提问来源于开源项目:meetecho/janus-gateway

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

8条回答

为你推荐

换一换