diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c index 1c42d636..9f861a38 100644 --- a/ivi-shell/ivi-layout.c +++ b/ivi-shell/ivi-layout.c @@ -1192,15 +1192,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; }