Resolve the possible use of negative value (detected by coverity tool)
[platform/upstream/at-spi2-core.git] / bus / at-spi-bus-launcher.c
index 65bb0b1..91bdd48 100644 (file)
@@ -393,14 +393,15 @@ ensure_a11y_bus_daemon (A11yBusLauncher *app, char *config_path)
   app->state = A11Y_BUS_STATE_RUNNING;
 
   /* Trim the trailing newline */
+  if (app->a11y_bus_address) g_free(app->a11y_bus_address);
   app->a11y_bus_address = g_strchomp (g_strdup (addr_buf));
   LOGD("a11y bus address: %s", app->a11y_bus_address);
 
   return TRUE;
 
 error:
-  close (app->pipefd[0]);
-  close (app->pipefd[1]);
+  if (app->pipefd[0] > 0) close (app->pipefd[0]);
+  if (app->pipefd[1] > 0) close (app->pipefd[1]);
   app->state = A11Y_BUS_STATE_ERROR;
 
   return FALSE;