From aad5b8b83e6542522b1a21972168fca1c2293c1d Mon Sep 17 00:00:00 2001 From: Stefan Schmidt Date: Tue, 2 Aug 2016 09:31:10 +0200 Subject: [PATCH] tests: ecore_con: make sure info is initialized One test does init info before passing it to _url_compl_cb while two others are not. Also test if inof is NULL in callback here to avoid crashes. tests/ecore_con/ecore_con_test_ecore_con_url.c:194:4: warning: 'info' may be used uninitialized in this function [-Wmaybe-uninitialized] ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE, --- src/tests/ecore_con/ecore_con_test_ecore_con_url.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tests/ecore_con/ecore_con_test_ecore_con_url.c b/src/tests/ecore_con/ecore_con_test_ecore_con_url.c index 0c1a602..1b73218 100644 --- a/src/tests/ecore_con/ecore_con_test_ecore_con_url.c +++ b/src/tests/ecore_con/ecore_con_test_ecore_con_url.c @@ -39,7 +39,7 @@ _url_compl_cb(void *data, int type EINA_UNUSED, void *event_info) printf("Total downloaded bytes = %d\n", ecore_con_url_received_bytes_get(ev->url_con)); - if (info->_tmpfd) + if (info && info->_tmpfd) { status = ecore_con_url_status_code_get(ev->url_con); fail_if(status != 220); @@ -167,7 +167,7 @@ error_user: START_TEST(ecore_con_test_ecore_con_url_ftp_upload) { Ecore_Con_Url *ec_url; - url_test *info; + url_test *info = NULL; int ret; char link[] = ECORE_CON_FTP_TEST_URL; char url[4096], *username, *password, *file = NULL, *dir = NULL; @@ -205,7 +205,7 @@ END_TEST START_TEST(ecore_con_test_ecore_con_url_post) { Ecore_Con_Url *ec_url; - url_test *info; + url_test *info = NULL; int ret; char link[] = ECORE_CON_HTTP_TEST_URL; char url_data[] = "test"; -- 2.7.4