ticker: perfrom additional null-check 21/139121/1
authorLukasz Stanislawski <l.stanislaws@samsung.com>
Mon, 17 Jul 2017 10:27:42 +0000 (12:27 +0200)
committerLukasz Stanislawski <l.stanislaws@samsung.com>
Mon, 17 Jul 2017 10:27:42 +0000 (12:27 +0200)
Fix potential issue spotted by PVS-Studio static analyzer and
described on https://www.viva64.com/en/b/0519/.
The _ticker_view_create may call _ticker_window_create with
invalid parameter. This situation cannot occur in current
code since ad is always valid pointer.

However function may cause crashes when some refactoring
will be applied without additional null-checking of 'ad' param.

Change-Id: I409ce3774390f9fa67ed26b7b9a8c34c5a7c077e

src/ticker.c

index bd35b7c..4445c40 100644 (file)
@@ -585,7 +585,7 @@ static void _ticker_window_destroy(void)
 
 static int _ticker_view_create(void)
 {
-       if (!ticker.win)
+       if (!ticker.win && ticker.ad)
                ticker.win = _ticker_window_create(ticker.ad);
        if (!ticker.layout)
                ticker.layout = _ticker_layout_create(ticker.win);