6e46cca735
When allocation with g_malloc(), the memory should be freed using g_free(), not plain free(). Also, use g_try_malloc() instead of g_malloc() where the code carefully handles allocation failures itself.