g_free() and g_match_info_free() already check if the given pointer is NULL and does nothing on a NULL pointer.