gdbus: Check pointer before dereference 34/253934/1 accepted/tizen/unified/20210222.215243 submit/tizen/20210219.120309
authorKonrad Kuchciak <k.kuchciak@samsung.com>
Fri, 19 Feb 2021 11:16:18 +0000 (12:16 +0100)
committerKonrad Kuchciak <k.kuchciak@samsung.com>
Fri, 19 Feb 2021 11:16:18 +0000 (12:16 +0100)
Change-Id: I2093875c5de833536573a16af7afb23af9629753

src/gdbus/peripheral_gdbus_adc.c
src/gdbus/peripheral_gdbus_gpio.c
src/gdbus/peripheral_gdbus_i2c.c
src/gdbus/peripheral_gdbus_pwm.c
src/gdbus/peripheral_gdbus_spi.c
src/gdbus/peripheral_gdbus_uart.c

index 4ef8ed359a2c0d469aa78fd8bc9842a036b413f6..30cc9b4e2e5b89a1f8df5c0f24a77076705fd643 100644 (file)
@@ -39,8 +39,10 @@ static int __adc_proxy_init(void)
                &error);
 
        if (adc_proxy == NULL) {
-               _E("Failed to create adc proxy : %s", error->message);
-               g_error_free(error);
+               if (error) {
+                       _E("Failed to create adc proxy : %s", error->message);
+                       g_error_free(error);
+               }
                return PERIPHERAL_ERROR_IO_ERROR;
        }
 
index dcc9ff21912af54ac4c04b674fd2b1128dbb9b32..e38b9b25ce4d01a562385b0eee9d763759dd697a 100644 (file)
@@ -41,8 +41,10 @@ static int __gpio_proxy_init(void)
                &error);
 
        if (gpio_proxy == NULL) {
-               _E("Failed to create gpio proxy : %s", error->message);
-               g_error_free(error);
+               if (error) {
+                       _E("Failed to create gpio proxy : %s", error->message);
+                       g_error_free(error);
+               }
                return PERIPHERAL_ERROR_IO_ERROR;
        }
 
index c2fb06fa985b2ac92921a6314e8daf97fe1e0ef2..f410f3e724f05776e830d319ad51c9fc0a79d8ea 100644 (file)
@@ -39,8 +39,10 @@ static int __i2c_proxy_init(void)
                &error);
 
        if (i2c_proxy == NULL) {
-               _E("Failed to create i2c proxy : %s", error->message);
-               g_error_free(error);
+               if (error) {
+                       _E("Failed to create i2c proxy : %s", error->message);
+                       g_error_free(error);
+               }
                return PERIPHERAL_ERROR_IO_ERROR;
        }
 
index 71a73446534308db64cdcc1fb957bb1c1e086130..74fae2c1b1cf4388c8032d0062bc717fdfca0b63 100644 (file)
@@ -42,8 +42,10 @@ static int __pwm_proxy_init(void)
                &error);
 
        if (pwm_proxy == NULL) {
-               _E("Failed to create pwm proxy : %s", error->message);
-               g_error_free(error);
+               if (error) {
+                       _E("Failed to create pwm proxy : %s", error->message);
+                       g_error_free(error);
+               }
                return PERIPHERAL_ERROR_IO_ERROR;
        }
 
index 2861d52ff71d0ab7d9ab61f5cfcde2380eb03fac..9fcf33991436d692f7c1a3dc5638de36f1a46965 100644 (file)
@@ -39,8 +39,10 @@ static int __spi_proxy_init(void)
                &error);
 
        if (spi_proxy == NULL) {
-               _E("Failed to create spi proxy : %s", error->message);
-               g_error_free(error);
+               if (error) {
+                       _E("Failed to create spi proxy : %s", error->message);
+                       g_error_free(error);
+               }
                return PERIPHERAL_ERROR_IO_ERROR;
        }
 
index 3376dffb14488d2f77e49290c4e79cbf41029fa3..86f75751e5e5aa7f78aed6e2a82189dc0ab74c53 100644 (file)
@@ -39,8 +39,10 @@ static int __uart_proxy_init(void)
                &error);
 
        if (uart_proxy == NULL) {
-               _E("Failed to create uart proxy : %s", error->message);
-               g_error_free(error);
+               if (error) {
+                       _E("Failed to create uart proxy : %s", error->message);
+                       g_error_free(error);
+               }
                return PERIPHERAL_ERROR_IO_ERROR;
        }