From 797b1a44c744b784d1b74cae23b042558606da45 Mon Sep 17 00:00:00 2001 From: Anoop Saldanha Date: Thu, 22 Sep 2011 22:26:21 +0530 Subject: [PATCH] Replace all strdup with SCStrdup --- src/util-debug.c | 12 ++++++------ src/util-mpm.c | 4 ++-- src/util-proto-name.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/util-debug.c b/src/util-debug.c index 4a96db50f4..bc5d09fa19 100644 --- a/src/util-debug.c +++ b/src/util-debug.c @@ -563,11 +563,11 @@ static inline SCLogOPIfaceCtx *SCLogInitFileOPIface(const char *file, goto error; } - if ((iface_ctx->file = strdup(file)) == NULL) { + if ((iface_ctx->file = SCStrdup(file)) == NULL) { goto error; } - if ((iface_ctx->log_format = strdup(log_format)) == NULL) { + if ((iface_ctx->log_format = SCStrdup(log_format)) == NULL) { goto error; } @@ -624,7 +624,7 @@ static inline SCLogOPIfaceCtx *SCLogInitConsoleOPIface(const char *log_format, } if (tmp_log_format != NULL && - (iface_ctx->log_format = strdup(tmp_log_format)) == NULL) { + (iface_ctx->log_format = SCStrdup(tmp_log_format)) == NULL) { printf("Error allocating memory\n"); exit(EXIT_FAILURE); } @@ -673,7 +673,7 @@ static inline SCLogOPIfaceCtx *SCLogInitSyslogOPIface(int facility, iface_ctx->facility = facility; if (log_format != NULL && - (iface_ctx->log_format = strdup(log_format)) == NULL) { + (iface_ctx->log_format = SCStrdup(log_format)) == NULL) { printf("Error allocating memory\n"); exit(EXIT_FAILURE); } @@ -794,7 +794,7 @@ static inline void SCLogSetLogFormat(SCLogInitData *sc_lid, SCLogConfig *sc_lc) #endif } - if (format != NULL && (sc_lc->log_format = strdup(format)) == NULL) { + if (format != NULL && (sc_lc->log_format = SCStrdup(format)) == NULL) { printf("Error allocating memory\n"); exit(EXIT_FAILURE); } @@ -1316,7 +1316,7 @@ void SCLogInitLogModuleIfEnvSet(void) } if (format != NULL && - (sc_lc->log_format = strdup(format)) == NULL) { + (sc_lc->log_format = SCStrdup(format)) == NULL) { printf("Error allocating memory\n"); exit(EXIT_FAILURE); } diff --git a/src/util-mpm.c b/src/util-mpm.c index 2b5f01903f..cc98a14007 100644 --- a/src/util-mpm.c +++ b/src/util-mpm.c @@ -72,7 +72,7 @@ int32_t MpmFactoryRegisterMpmCtxProfile(const char *name, uint8_t flags) exit(EXIT_FAILURE); } - item[0].name = strdup(name); + item[0].name = SCStrdup(name); if (item[0].name == NULL) { SCLogError(SC_ERR_MEM_ALLOC, "Error allocating memory"); exit(EXIT_FAILURE); @@ -128,7 +128,7 @@ int32_t MpmFactoryRegisterMpmCtxProfile(const char *name, uint8_t flags) mpm_ctx_factory_container->items = items; MpmCtxFactoryItem *new_item = &items[mpm_ctx_factory_container->no_of_items]; - new_item[0].name = strdup(name); + new_item[0].name = SCStrdup(name); if (new_item[0].name == NULL) { SCLogError(SC_ERR_MEM_ALLOC, "Error allocating memory"); exit(EXIT_FAILURE); diff --git a/src/util-proto-name.c b/src/util-proto-name.c index 841d71f552..d7fc97a9e9 100644 --- a/src/util-proto-name.c +++ b/src/util-proto-name.c @@ -57,9 +57,9 @@ void SCProtoNameInit() char *cname = strtok_r(NULL, " \t", &ptr); if (cname != NULL) { - known_proto[proto] = strdup(cname); + known_proto[proto] = SCStrdup(cname); } else { - known_proto[proto] = strdup(name); + known_proto[proto] = SCStrdup(name); } } fclose(fp);