Add music_library_add and fix memory allocation