X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=clients%2Fmemcp.cc;h=1551a1d50b3109d338a5d5c9ab0800b3de6f6ac9;hb=6b83fd5838692b71a50710b9bc13680f9c586167;hp=59bd7478bb780a89d447d9c8949b1381c7342baa;hpb=b43d7591dbe31dedd9fed41f01d07e8a3412582b;p=m6w6%2Flibmemcached diff --git a/clients/memcp.cc b/clients/memcp.cc index 59bd7478..1551a1d5 100644 --- a/clients/memcp.cc +++ b/clients/memcp.cc @@ -1,4 +1,5 @@ /* LibMemcached + * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/ * Copyright (C) 2006-2009 Brian Aker * All rights reserved. * @@ -9,7 +10,7 @@ * */ -#include "config.h" +#include "mem_config.h" #include #include @@ -30,7 +31,7 @@ #include -#include +#include #include "client_options.h" #include "utilities.h" @@ -207,6 +208,7 @@ int main(int argc, char *argv[]) if ((file_buffer_ptr= (char *)malloc(sizeof(char) * (size_t)sbuf.st_size)) == NULL) { std::cerr << "Error allocating file buffer(" << strerror(errno) << ")" << std::endl; + close(fd); exit(EXIT_FAILURE); } @@ -214,12 +216,14 @@ int main(int argc, char *argv[]) if ((read_length= ::read(fd, file_buffer_ptr, (size_t)sbuf.st_size)) == -1) { std::cerr << "Error while reading file " << file_buffer_ptr << " (" << strerror(errno) << ")" << std::endl; + close(fd); exit(EXIT_FAILURE); } if (read_length != sbuf.st_size) { std::cerr << "Failure while reading file. Read length was not equal to stat() length" << std::endl; + close(fd); exit(EXIT_FAILURE); }