fixed compiler warning: 'upper_layer_memlen' may be used uninitialized in this function