summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrond Norbye <Trond.Norbye@sun.com>2009-08-21 08:37:57 +0200
committerDustin Sallings <dustin@spy.net>2009-08-22 23:38:12 -0700
commit89d5126bdb65fa9bcc945dd77fdf71261becd72e (patch)
tree4f67eb78d5e3b4da98ab2ea708746e5322d62844
parentb416a193b56e597bc94955cb19f562f94f31e972 (diff)
downloadmemcached-89d5126bdb65fa9bcc945dd77fdf71261becd72e.tar.gz
Issue #77: Bug in the realloc code caused the previous allocated buffer to be reused...
-rw-r--r--memcached.c11
-rw-r--r--testapp.c5
2 files changed, 14 insertions, 2 deletions
diff --git a/memcached.c b/memcached.c
index 7ae1417..59b4284 100644
--- a/memcached.c
+++ b/memcached.c
@@ -1443,6 +1443,7 @@ static void bin_read_key(conn *c, enum bin_substates next_substate, int extra) {
return;
}
+ c->rbuf= newm;
/* rcurr should point to the same offset in the packet */
c->rcurr = c->rbuf + offset - sizeof(protocol_binary_request_header);
c->rsize = nsize;
@@ -3339,8 +3340,14 @@ static void drive_machine(conn *c) {
break;
}
/* otherwise we have a real error, on which we close the connection */
- if (settings.verbose > 0)
- fprintf(stderr, "Failed to read, and not due to blocking\n");
+ if (settings.verbose > 0) {
+ fprintf(stderr, "Failed to read, and not due to blocking:\n"
+ "errno: %d %s \n"
+ "rcurr=%lx ritem=%lx rbuf=%lx rlbytes=%d rsize=%d\n",
+ errno, strerror(errno),
+ (long)c->rcurr, (long)c->ritem, (long)c->rbuf,
+ (int)c->rlbytes, (int)c->rsize);
+ }
conn_set_state(c, conn_closing);
break;
diff --git a/testapp.c b/testapp.c
index d93f1e2..388a454 100644
--- a/testapp.c
+++ b/testapp.c
@@ -268,6 +268,11 @@ static pid_t start_server(in_port_t *port_out, bool daemon) {
char *argv[20];
int arg = 0;
putenv(environment);
+#ifdef __sun
+ putenv("LD_PRELOAD=watchmalloc.so.1");
+ putenv("MALLOC_DEBUG=WATCH");
+#endif
+
if (!daemon) {
argv[arg++] = "./timedrun";
argv[arg++] = "15";