~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to libdrizzle/conn.cc

  • Committer: Mark Atwood
  • Date: 2011-12-30 22:59:59 UTC
  • mfrom: (2478.1.3 drizzle-build)
  • Revision ID: me@mark.atwood.name-20111230225959-m3wdvqiymv3a4q2w
mergeĀ lp:~brianaker/drizzle/yacc-merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
 * @brief Connection Definitions
42
42
 */
43
43
 
44
 
#include <libdrizzle-1.0/common.h>
 
44
#include <libdrizzle/common.h>
45
45
 
46
46
/**
47
47
 * @addtogroup drizzle_con_static Static Connection Declarations
1009
1009
 
1010
1010
  if (con->command_buffer == NULL)
1011
1011
  {
1012
 
    con->command_buffer= (uint8_t*)malloc((*total) + 1);
 
1012
    con->command_buffer= (uint8_t*)realloc(NULL, (*total) +1);
1013
1013
    if (con->command_buffer == NULL)
1014
1014
    {
1015
 
      drizzle_set_error(con->drizzle, "drizzle_command_buffer", "malloc");
 
1015
      drizzle_set_error(con->drizzle, __func__, "Failed to allocate.");
1016
1016
      *ret_ptr= DRIZZLE_RETURN_MEMORY;
1017
1017
      return NULL;
1018
1018
    }
1127
1127
    else
1128
1128
    {
1129
1129
      if (tcp->host == NULL)
 
1130
      {
1130
1131
        host= DRIZZLE_DEFAULT_TCP_HOST;
 
1132
      }
1131
1133
      else
 
1134
      {
1132
1135
        host= tcp->host;
 
1136
      }
1133
1137
    }
1134
1138
 
1135
1139
    ret= getaddrinfo(host, port, &ai, &(tcp->addrinfo));
1136
1140
    if (ret != 0)
1137
1141
    {
1138
 
      drizzle_set_error(con->drizzle, "drizzle_state_addrinfo",
1139
 
                        "getaddrinfo:%s", gai_strerror(ret));
 
1142
      drizzle_set_error(con->drizzle, "drizzle_state_addrinfo", "getaddrinfo:%s", gai_strerror(ret));
1140
1143
      return DRIZZLE_RETURN_GETADDRINFO;
1141
1144
    }
1142
1145