Use coccinelle to cleanup the failure handling blocks from isc_mem_strdup
This commit is contained in:
@@ -1196,10 +1196,6 @@ isc_httpdmgr_addurl2(isc_httpdmgr_t *httpdmgr, const char *url,
|
||||
item = isc_mem_get(httpdmgr->mctx, sizeof(isc_httpdurl_t));
|
||||
|
||||
item->url = isc_mem_strdup(httpdmgr->mctx, url);
|
||||
if (item->url == NULL) {
|
||||
isc_mem_put(httpdmgr->mctx, item, sizeof(isc_httpdurl_t));
|
||||
return (ISC_R_NOMEMORY);
|
||||
}
|
||||
|
||||
item->action = func;
|
||||
item->action_arg = arg;
|
||||
|
||||
@@ -191,10 +191,6 @@ new_source(isc_lex_t *lex, bool is_file, bool need_close,
|
||||
source->last_was_eol = lex->last_was_eol;
|
||||
source->input = input;
|
||||
source->name = isc_mem_strdup(lex->mctx, name);
|
||||
if (source->name == NULL) {
|
||||
isc_mem_put(lex->mctx, source, sizeof(*source));
|
||||
return (ISC_R_NOMEMORY);
|
||||
}
|
||||
source->pushback = NULL;
|
||||
result = isc_buffer_allocate(lex->mctx, &source->pushback,
|
||||
(unsigned int)lex->max_token);
|
||||
@@ -1000,8 +996,6 @@ isc_lex_setsourcename(isc_lex_t *lex, const char *name) {
|
||||
if (source == NULL)
|
||||
return (ISC_R_NOTFOUND);
|
||||
newname = isc_mem_strdup(lex->mctx, name);
|
||||
if (newname == NULL)
|
||||
return (ISC_R_NOMEMORY);
|
||||
isc_mem_free(lex->mctx, source->name);
|
||||
source->name = newname;
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
@@ -702,10 +702,6 @@ isc_log_createchannel(isc_logconfig_t *lcfg, const char *name,
|
||||
channel = isc_mem_get(mctx, sizeof(*channel));
|
||||
|
||||
channel->name = isc_mem_strdup(mctx, name);
|
||||
if (channel->name == NULL) {
|
||||
isc_mem_put(mctx, channel, sizeof(*channel));
|
||||
return (ISC_R_NOMEMORY);
|
||||
}
|
||||
|
||||
channel->type = type;
|
||||
channel->level = level;
|
||||
@@ -723,8 +719,8 @@ isc_log_createchannel(isc_logconfig_t *lcfg, const char *name,
|
||||
* to scribble on it, so it needs to be definitely in
|
||||
* writable memory.
|
||||
*/
|
||||
FILE_NAME(channel) =
|
||||
isc_mem_strdup(mctx, destination->file.name);
|
||||
FILE_NAME(channel) = isc_mem_strdup(mctx,
|
||||
destination->file.name);
|
||||
FILE_STREAM(channel) = NULL;
|
||||
FILE_VERSIONS(channel) = destination->file.versions;
|
||||
FILE_SUFFIX(channel) = destination->file.suffix;
|
||||
@@ -920,8 +916,6 @@ isc_log_settag(isc_logconfig_t *lcfg, const char *tag) {
|
||||
if (lcfg->tag != NULL)
|
||||
isc_mem_free(lcfg->lctx->mctx, lcfg->tag);
|
||||
lcfg->tag = isc_mem_strdup(lcfg->lctx->mctx, tag);
|
||||
if (lcfg->tag == NULL)
|
||||
return (ISC_R_NOMEMORY);
|
||||
|
||||
} else {
|
||||
if (lcfg->tag != NULL)
|
||||
|
||||
Reference in New Issue
Block a user