← Back to team overview

linux-traipu team mailing list archive

[Bug 917588] [NEW] Wrong client_con_st.con member declaration

 

Public bug reported:

Trying to use libdrizzle 2.0 on win32 with sqlite3 I found that the
supplied examples doesn't work, the client segfualts because it refer to
an unitilized con struct.

Studing the client example I found that the member con of client_con_st
structure should be a pointer because on the example there is an attempt
to delete it.

typedef struct
{
  drizzle_con_st *con;   <<<<<  pointer
  drizzle_result_st result;
  drizzle_column_st column;
  client_state state;
  uint64_t row;
} client_con_st;

-------
  for (x= 0; x < client.client_con_count; x++)
  {
    /* This may fail if there is other initialization that fails. See docs. */
    drizzle_con_st *con= drizzle_con_add_tcp(client.drizzle,
                                             host, port, user, password, db,
                                             client.mysql_protocol
                                             ? DRIZZLE_CON_MYSQL
                                             : DRIZZLE_CON_NONE);
    if (con == NULL)
    {
      CLIENT_ERROR("drizzle_con_add_tcp", 0, &client);
    }
    client.client_con_list[x].con = con; <<<<<< assign here as pointer because if not
    drizzle_con_set_context(client.client_con_list[x].con,
                            &(client.client_con_list[x]));

    if (client_process(&client, &(client.client_con_list[x])) == 1)  <<<< it will segfault on further calls here
      wait_for_connections++;
  }
---------------

  for (x= 0; x < client.client_con_count; x++)
  {
    drizzle_con_free(&(client.client_con_list[x].con)); <<<<< try to delete 
  }

Seems to be this that will work with con as a pointer:

for (x= 0; x < client.client_con_count; x++)
  {
    drizzle_con_free(client.client_con_list[x].con);  <<<<   pointer that will be deleted
  }

** Affects: drizzle
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of UBUNTU -
AL - BR, which is subscribed to Drizzle.
https://bugs.launchpad.net/bugs/917588

Title:
  Wrong client_con_st.con member declaration

Status in A Lightweight SQL Database for Cloud Infrastructure and Web Applications:
  New

Bug description:
  Trying to use libdrizzle 2.0 on win32 with sqlite3 I found that the
  supplied examples doesn't work, the client segfualts because it refer
  to an unitilized con struct.

  Studing the client example I found that the member con of
  client_con_st structure should be a pointer because on the example
  there is an attempt to delete it.

  typedef struct
  {
    drizzle_con_st *con;   <<<<<  pointer
    drizzle_result_st result;
    drizzle_column_st column;
    client_state state;
    uint64_t row;
  } client_con_st;

  -------
    for (x= 0; x < client.client_con_count; x++)
    {
      /* This may fail if there is other initialization that fails. See docs. */
      drizzle_con_st *con= drizzle_con_add_tcp(client.drizzle,
                                               host, port, user, password, db,
                                               client.mysql_protocol
                                               ? DRIZZLE_CON_MYSQL
                                               : DRIZZLE_CON_NONE);
      if (con == NULL)
      {
        CLIENT_ERROR("drizzle_con_add_tcp", 0, &client);
      }
      client.client_con_list[x].con = con; <<<<<< assign here as pointer because if not
      drizzle_con_set_context(client.client_con_list[x].con,
                              &(client.client_con_list[x]));

      if (client_process(&client, &(client.client_con_list[x])) == 1)  <<<< it will segfault on further calls here
        wait_for_connections++;
    }
  ---------------

    for (x= 0; x < client.client_con_count; x++)
    {
      drizzle_con_free(&(client.client_con_list[x].con)); <<<<< try to delete 
    }

  Seems to be this that will work with con as a pointer:

  for (x= 0; x < client.client_con_count; x++)
    {
      drizzle_con_free(client.client_con_list[x].con);  <<<<   pointer that will be deleted
    }

To manage notifications about this bug go to:
https://bugs.launchpad.net/drizzle/+bug/917588/+subscriptions


Follow ups

References