diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c index 2a7ff529..9e9ad338 100644 --- a/ivi-shell/ivi-layout.c +++ b/ivi-shell/ivi-layout.c @@ -1194,15 +1194,14 @@ ivi_layout_get_layers_under_surface(struct ivi_layout_surface *ivisurf, else length--; } + if (length == 0) { + free(*ppArray); + *ppArray = NULL; + } } *pLength = length; - if (!length) { - free(*ppArray); - *ppArray = NULL; - } - return IVI_SUCCEEDED; }