kernel/environ: Fix an error in the duplication of the child tasks environment
kernel/environ: Fix an error in the duplication of the child tasks environment

Fix an error in the duplication of the child tasks environment in the special case
where the parent's environment was created, but then all of the variables were unset.
In that case, there is still an allocation in place but the size of the allocation is zero.
This case was not being handled correctly when a child task attempts to create its environment
and inherit the zero-size parent environment. Noted by Anthony Merlino.

This patch is back-ported from Nuttx.

Signed-off-by: Lokesh B V <a10c1c2561c872cd1fd5899c4340d5ec87a91507@partner.samsung.com>

davidfather/TizenRT,pillip8282/TizenRT,lokeshbv/TizenRT,lokeshbv/TizenRT,lokeshbv/TizenRT,sunghan-chang/TizenRT,jeongarmy/TizenRT,chanijjani/TizenRT,lokeshbv/TizenRT,sunghan-chang/TizenRT,jsdosa/TizenRT,pillip8282/TizenRT,jsdosa/TizenRT,JeonginKim/TizenRT,Samsung/TizenRT,Samsung/TizenRT,chanijjani/TizenRT,chanijjani/TizenRT,junmin-kim/TizenRT,sunghan-chang/TizenRT,jeongarmy/TizenRT,jeongchanKim/TizenRT,JeonginKim/TizenRT,lokeshbv/TizenRT,davidfather/TizenRT,jeongarmy/TizenRT,jsdosa/TizenRT,jsdosa/TizenRT,davidfather/TizenRT,Samsung/TizenRT,lokeshbv/TizenRT,jeongarmy/TizenRT,an4967/TizenRT,jeongarmy/TizenRT,davidfather/TizenRT,jsdosa/TizenRT,an4967/TizenRT,HONGCHAEHEE/TizenRT,pillip8282/TizenRT,jeongchanKim/TizenRT,an4967/TizenRT,an4967/TizenRT,jeongarmy/TizenRT,sunghan-chang/TizenRT,junmin-kim/TizenRT,jeongchanKim/TizenRT,pillip8282/TizenRT,junmin-kim/TizenRT,HONGCHAEHEE/TizenRT,jeongchanKim/TizenRT,Samsung/TizenRT,JeonginKim/TizenRT,jeongarmy/TizenRT,davidfather/TizenRT,HONGCHAEHEE/TizenRT,an4967/TizenRT,sunghan-chang/TizenRT,chanijjani/TizenRT,Samsung/TizenRT,chanijjani/TizenRT,pillip8282/TizenRT,junmin-kim/TizenRT,HONGCHAEHEE/TizenRT,jeongchanKim/TizenRT,jeongchanKim/TizenRT,davidfather/TizenRT,JeonginKim/TizenRT,Samsung/TizenRT,chanijjani/TizenRT,junmin-kim/TizenRT,JeonginKim/TizenRT,junmin-kim/TizenRT,sunghan-chang/TizenRT,pillip8282/TizenRT,JeonginKim/TizenRT,davidfather/TizenRT,jsdosa/TizenRT,sunghan-chang/TizenRT,junmin-kim/TizenRT,an4967/TizenRT,jsdosa/TizenRT,an4967/TizenRT,HONGCHAEHEE/TizenRT,Samsung/TizenRT,pillip8282/TizenRT,HONGCHAEHEE/TizenRT,jeongchanKim/TizenRT,chanijjani/TizenRT