diff --git a/csync/src/csync_exclude.c b/csync/src/csync_exclude.c index f4500b9b13..1d81bbfced 100644 --- a/csync/src/csync_exclude.c +++ b/csync/src/csync_exclude.c @@ -103,11 +103,6 @@ int csync_exclude_load(const char *fname, c_strlist_t **list) { goto out; } buf = c_malloc(size + 1); - if (buf == NULL) { - rc = -1; - goto out; - } - if (read(fd, buf, size) != size) { rc = -1; goto out; diff --git a/csync/src/csync_statedb.c b/csync/src/csync_statedb.c index 136b7d4927..1f82e8c3e1 100644 --- a/csync/src/csync_statedb.c +++ b/csync/src/csync_statedb.c @@ -251,9 +251,6 @@ static int _csync_file_stat_from_metadata_table( csync_file_stat_t **st, sqlite3 /* phash, pathlen, path, inode, uid, gid, mode, modtime */ len = sqlite3_column_int(stmt, 1); *st = c_malloc(sizeof(csync_file_stat_t) + len + 1); - if (*st == NULL) { - return SQLITE_NOMEM; - } /* clear the whole structure */ ZERO_STRUCTP(*st); diff --git a/csync/src/csync_update.c b/csync/src/csync_update.c index e623779197..b6346efdbc 100644 --- a/csync/src/csync_update.c +++ b/csync/src/csync_update.c @@ -201,10 +201,6 @@ static int _csync_detect_update(CSYNC *ctx, const char *file, size = sizeof(csync_file_stat_t) + len + 1; st = c_malloc(size); - if (st == NULL) { - ctx->status_code = CSYNC_STATUS_MEMORY_ERROR; - return -1; - } /* Set instruction by default to none */ st->instruction = CSYNC_INSTRUCTION_NONE; diff --git a/csync/src/httpbf/src/httpbf.c b/csync/src/httpbf/src/httpbf.c index 3c5f2107d3..815b07e13b 100644 --- a/csync/src/httpbf/src/httpbf.c +++ b/csync/src/httpbf/src/httpbf.c @@ -260,9 +260,6 @@ static char* get_transfer_url( hbf_transfer_t *transfer, int indx ) { len += strlen("-chunking---"); res = malloc(len); - if( res == NULL ) { - return NULL; - } /* Note: must be %u for unsigned because one does not want '--' */ if( sprintf(res, "%s-chunking-%u-%u-%u", transfer->url, transfer->transfer_id, diff --git a/csync/src/std/c_list.c b/csync/src/std/c_list.c index 5b98e777e1..02328b74fe 100644 --- a/csync/src/std/c_list.c +++ b/csync/src/std/c_list.c @@ -179,9 +179,6 @@ c_list_t *c_list_alloc(void) { c_list_t *list = NULL; list = c_malloc(sizeof(c_list_t)); - if (list == NULL) { - return NULL; - } list->data = NULL; diff --git a/csync/src/std/c_path.c b/csync/src/std/c_path.c index c0e414a933..f9a7dccdaf 100644 --- a/csync/src/std/c_path.c +++ b/csync/src/std/c_path.c @@ -67,9 +67,6 @@ char *c_dirname (const char *path) { while(len > 0 && path[len - 1] == '/') --len; newbuf = c_malloc(len + 1); - if (newbuf == NULL) { - return NULL; - } strncpy(newbuf, path, len); newbuf[len] = '\0'; @@ -107,9 +104,6 @@ char *c_basename (const char *path) { } newbuf = c_malloc(len + 1); - if (newbuf == NULL) { - return NULL; - } strncpy(newbuf, s, len); newbuf[len] = '\0'; diff --git a/csync/src/std/c_rbtree.c b/csync/src/std/c_rbtree.c index 4b5efb4cd5..9cda675c25 100644 --- a/csync/src/std/c_rbtree.c +++ b/csync/src/std/c_rbtree.c @@ -47,10 +47,6 @@ int c_rbtree_create(c_rbtree_t **rbtree, c_rbtree_compare_func *key_compare, c_r } tree = c_malloc(sizeof(*tree)); - if (tree == NULL) { - return -1; - } - tree->root = NIL; tree->key_compare = key_compare; tree->data_compare = data_compare; @@ -400,10 +396,6 @@ int c_rbtree_insert(c_rbtree_t *tree, void *data) { } x = (c_rbnode_t *) c_malloc(sizeof(c_rbnode_t)); - if (x == NULL) { - errno = ENOMEM; - return -1; - } x->tree = tree; x->data = data; diff --git a/csync/src/std/c_string.c b/csync/src/std/c_string.c index f1ca5f7479..d164ee7c80 100644 --- a/csync/src/std/c_string.c +++ b/csync/src/std/c_string.c @@ -115,10 +115,6 @@ static char *c_iconv(const char* str, enum iconv_direction dir) out = c_malloc(outsize); out_in = out; - if (out == NULL) { - return NULL; - } - if (dir == iconv_to_native) { ret = iconv(_iconvs.to, &in, &size, &out, &outsize); } else { @@ -173,10 +169,6 @@ c_strlist_t *c_strlist_new(size_t size) { } strlist->vector = (char **) c_malloc(size * sizeof(char *)); - if (strlist->vector == NULL) { - SAFE_FREE(strlist); - return NULL; - } strlist->count = 0; strlist->size = size; @@ -267,10 +259,6 @@ char* c_utf8_from_locale(const mbchar_t *wstr) size_needed = WideCharToMultiByte(CP_UTF8, 0, wstr, len, NULL, 0, NULL, NULL); if (size_needed > 0) { mdst = c_malloc(size_needed + 1); - if (mdst == NULL) { - errno = ENOMEM; - return NULL; - } memset(mdst, 0, size_needed + 1); WideCharToMultiByte(CP_UTF8, 0, wstr, len, mdst, size_needed, NULL, NULL); @@ -305,11 +293,6 @@ mbchar_t* c_utf8_to_locale(const char *str) if (size_needed > 0) { int size_char = (size_needed + 1) * sizeof(mbchar_t); dst = c_malloc(size_char); - if (dst == NULL) { - errno = ENOMEM; - return NULL; - } - memset((void*)dst, 0, size_char); MultiByteToWideChar(CP_UTF8, 0, str, -1, dst, size_needed); } diff --git a/csync/src/vio/csync_vio_local.c b/csync/src/vio/csync_vio_local.c index 6d24b4e92a..9dca13e4e5 100644 --- a/csync/src/vio/csync_vio_local.c +++ b/csync/src/vio/csync_vio_local.c @@ -53,10 +53,6 @@ csync_vio_handle_t *csync_vio_local_opendir(const char *name) { mbchar_t *dirname = c_utf8_to_locale(name); handle = c_malloc(sizeof(dhandle_t)); - if (handle == NULL) { - c_free_locale_string(dirname); - return NULL; - } handle->dh = _topendir( dirname ); if (handle->dh == NULL) {