use of g_free() cause heap damage on windows if memory is allocated by malloc(). Key is allocated by malloc() in sprintf_alloc(), so free() should use.