Changeset 76

Show
Ignore:
Timestamp:
12/21/09 23:10:41 (4 years ago)
Author:
jesus
Message:

SPI_finish frees the return memory, need to call it after we use the results

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/contrib/pg_amqp/pg_amqp.c

    r73 r76  
    171171      pass = SPI_getvalue(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 5); 
    172172      if(!pass) pass = "guest"; 
    173       SPI_finish(); 
    174173 
    175174      bs->conn = amqp_new_connection(); 
    176       if(!bs->conn) return NULL; 
     175      if(!bs->conn) { SPI_finish(); return NULL; } 
    177176      bs->sockfd = amqp_open_socket(host, port); 
    178177      if(bs->sockfd < 0) goto busted; 
     
    205204    } else { 
    206205      elog(WARNING, "amqp can't find broker %d", broker_id); 
    207       SPI_finish(); 
    208206    } 
    209207  } else { 
    210208    elog(WARNING, "amqp broker lookup query failed"); 
    211     SPI_finish(); 
    212   } 
     209  } 
     210  SPI_finish(); 
    213211  return bs; 
    214212 busted: 
     213  SPI_finish(); 
    215214  local_amqp_disconnect_bs(bs); 
    216215  return bs;