Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed the Memcached addon

  • Loading branch information...
commit 098921f8625a2da81df24e2142ef5a4c2acb8078 1 parent 2f75a4c
@jcowgar jcowgar authored
Showing with 10 additions and 5 deletions.
  1. +1 −1  addons/CMakeLists.txt
  2. +9 −4 addons/Memcached/source/IoMemcached.c
View
2  addons/CMakeLists.txt
@@ -75,7 +75,7 @@ add_subdirectory(Libxml2)
add_subdirectory(Loki)
add_subdirectory(Loudmouth)
add_subdirectory(MD5)
-#add_subdirectory(Memcached)
+add_subdirectory(Memcached)
add_subdirectory(MySQL)
#add_subdirectory(NetworkAdapter)
add_subdirectory(NotificationCenter)
View
13 addons/Memcached/source/IoMemcached.c
@@ -88,8 +88,13 @@ IoObject *IoMemcached_new(void *state)
void IoMemcached_free(IoMemcached *self)
{
- memcached_free(DATA(self)->mc);
- free(DATA(self));
+ if (DATA(self) != NULL) {
+ if (DATA(self)->mc != NULL) {
+ memcached_free(DATA(self)->mc);
+ }
+
+ free(DATA(self));
+ }
}
/*doc Memcached addServer(address)
@@ -467,8 +472,8 @@ IoObject *IoMemcached_stats(IoMemcached *self, IoObject *locals, IoMessage *m)
IoMap *results_map = IoMap_new(IOSTATE);
int i;
- for(i = 0; i < memcached_server_list_count(DATA(self)->mc->hosts); i++) {
- memcached_server_st *server = DATA(self)->mc->hosts + i;
+ for(i = 0; i < memcached_server_list_count(DATA(self)->mc->servers); i++) {
+ memcached_server_st *server = DATA(self)->mc->servers + i;
memcached_stat_st stats;
if(memcached_stat_servername(&stats, "", server->hostname, server->port) != 0)
Please sign in to comment.
Something went wrong with that request. Please try again.