[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r3514 - in GNUnet/src: applications/fs/ecrs applications/fs
From: |
grothoff |
Subject: |
[GNUnet-SVN] r3514 - in GNUnet/src: applications/fs/ecrs applications/fs/fsui applications/fs/lib util/network_client |
Date: |
Fri, 20 Oct 2006 16:41:11 -0700 (PDT) |
Author: grothoff
Date: 2006-10-20 16:41:07 -0700 (Fri, 20 Oct 2006)
New Revision: 3514
Modified:
GNUnet/src/applications/fs/ecrs/search.c
GNUnet/src/applications/fs/ecrs/unindex.c
GNUnet/src/applications/fs/fsui/downloadtest.c
GNUnet/src/applications/fs/lib/fslib.c
GNUnet/src/util/network_client/tcpio.c
Log:
fixing memory and socket leaks
Modified: GNUnet/src/applications/fs/ecrs/search.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/search.c 2006-10-20 20:28:14 UTC (rev
3513)
+++ GNUnet/src/applications/fs/ecrs/search.c 2006-10-20 23:41:07 UTC (rev
3514)
@@ -589,6 +589,7 @@
addQueryForURI(uri,
&ctx);
while ( (OK == tt(ttClosure)) &&
+ (NO == GNUNET_SHUTDOWN_TEST()) &&
(timeout > now) &&
(ctx.aborted == NO) ) {
remTime = timeout - now;
Modified: GNUnet/src/applications/fs/ecrs/unindex.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/unindex.c 2006-10-20 20:28:14 UTC (rev
3513)
+++ GNUnet/src/applications/fs/ecrs/unindex.c 2006-10-20 23:41:07 UTC (rev
3514)
@@ -389,7 +389,7 @@
goto FAILURE;
}
}
-
+ FREE(iblocks[treedepth]);
/* free resources */
FREE(iblocks);
FREE(dblock);
Modified: GNUnet/src/applications/fs/fsui/downloadtest.c
===================================================================
--- GNUnet/src/applications/fs/fsui/downloadtest.c 2006-10-20 20:28:14 UTC
(rev 3513)
+++ GNUnet/src/applications/fs/fsui/downloadtest.c 2006-10-20 23:41:07 UTC
(rev 3514)
@@ -35,7 +35,7 @@
#include "gnunet_util_network_client.h"
#include "gnunet_util_crypto.h"
-#define DEBUG_VERBOSE YES
+#define DEBUG_VERBOSE NO
#define CHECK(a) if (!(a)) { ok = NO; GE_BREAK(ectx, 0); goto FAILURE; }
@@ -347,7 +347,7 @@
if (GNUNET_SHUTDOWN_TEST() == YES)
break;
}
- CHECK(search != NULL);
+ CHECK(search == NULL);
CHECK(download != NULL);
waitForEvent = FSUI_unindex_completed;
unindex = FSUI_startUnindex(ctx, fn);
Modified: GNUnet/src/applications/fs/lib/fslib.c
===================================================================
--- GNUnet/src/applications/fs/lib/fslib.c 2006-10-20 20:28:14 UTC (rev
3513)
+++ GNUnet/src/applications/fs/lib/fslib.c 2006-10-20 23:41:07 UTC (rev
3514)
@@ -150,6 +150,7 @@
struct GC_Configuration * cfg,
struct MUTEX * lock) {
SEARCH_CONTEXT * ret;
+
ret = MALLOC(sizeof(SEARCH_CONTEXT));
ret->ectx = ectx;
ret->cfg = cfg;
@@ -172,7 +173,8 @@
void FS_SEARCH_destroyContext(struct FS_SEARCH_CONTEXT * ctx) {
void * unused;
- GE_ASSERT(ctx->ectx, ctx->handleCount == 0);
+ GE_ASSERT(ctx->ectx,
+ ctx->handleCount == 0);
ctx->abort = YES;
connection_close_temporarily(ctx->sock);
PTHREAD_JOIN(ctx->thread,
Modified: GNUnet/src/util/network_client/tcpio.c
===================================================================
--- GNUnet/src/util/network_client/tcpio.c 2006-10-20 20:28:14 UTC (rev
3513)
+++ GNUnet/src/util/network_client/tcpio.c 2006-10-20 23:41:07 UTC (rev
3514)
@@ -191,12 +191,19 @@
FREE(host);
return SYSERR;
}
+ MUTEX_LOCK(sock->destroylock);
+ if (sock->sock != NULL) {
+ FREE(host);
+ MUTEX_UNLOCK(sock->destroylock);
+ return OK;
+ }
osock = SOCKET(PF_INET, SOCK_STREAM, 6); /* 6: TCP */
if (osock == -1) {
GE_LOG_STRERROR(sock->ectx,
GE_ERROR | GE_USER | GE_ADMIN | GE_BULK,
"socket");
FREE(host);
+ MUTEX_UNLOCK(sock->destroylock);
return SYSERR;
}
sock->sock = socket_create(sock->ectx,
@@ -222,7 +229,9 @@
port,
STRERROR(errno));
socket_destroy(sock->sock);
+ sock->sock = NULL;
FREE(host);
+ MUTEX_UNLOCK(sock->destroylock);
return SYSERR;
}
/* we call select() first with a timeout of 5s to
@@ -250,11 +259,14 @@
port,
STRERROR(errno));
socket_destroy(sock->sock);
+ sock->sock = NULL;
FREE(host);
+ MUTEX_UNLOCK(sock->destroylock);
return SYSERR;
}
FREE(host);
socket_set_blocking(sock->sock, YES);
+ MUTEX_UNLOCK(sock->destroylock);
return OK;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r3514 - in GNUnet/src: applications/fs/ecrs applications/fs/fsui applications/fs/lib util/network_client,
grothoff <=