Replace all strdup with SCStrdup

remotes/origin/master-1.1.x
Anoop Saldanha 14 years ago committed by Victor Julien
parent 13ea299ee0
commit 797b1a44c7

@ -563,11 +563,11 @@ static inline SCLogOPIfaceCtx *SCLogInitFileOPIface(const char *file,
goto error; goto error;
} }
if ((iface_ctx->file = strdup(file)) == NULL) { if ((iface_ctx->file = SCStrdup(file)) == NULL) {
goto error; goto error;
} }
if ((iface_ctx->log_format = strdup(log_format)) == NULL) { if ((iface_ctx->log_format = SCStrdup(log_format)) == NULL) {
goto error; goto error;
} }
@ -624,7 +624,7 @@ static inline SCLogOPIfaceCtx *SCLogInitConsoleOPIface(const char *log_format,
} }
if (tmp_log_format != NULL && 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"); printf("Error allocating memory\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -673,7 +673,7 @@ static inline SCLogOPIfaceCtx *SCLogInitSyslogOPIface(int facility,
iface_ctx->facility = facility; iface_ctx->facility = facility;
if (log_format != NULL && 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"); printf("Error allocating memory\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -794,7 +794,7 @@ static inline void SCLogSetLogFormat(SCLogInitData *sc_lid, SCLogConfig *sc_lc)
#endif #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"); printf("Error allocating memory\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -1316,7 +1316,7 @@ void SCLogInitLogModuleIfEnvSet(void)
} }
if (format != NULL && if (format != NULL &&
(sc_lc->log_format = strdup(format)) == NULL) { (sc_lc->log_format = SCStrdup(format)) == NULL) {
printf("Error allocating memory\n"); printf("Error allocating memory\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }

@ -72,7 +72,7 @@ int32_t MpmFactoryRegisterMpmCtxProfile(const char *name, uint8_t flags)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
item[0].name = strdup(name); item[0].name = SCStrdup(name);
if (item[0].name == NULL) { if (item[0].name == NULL) {
SCLogError(SC_ERR_MEM_ALLOC, "Error allocating memory"); SCLogError(SC_ERR_MEM_ALLOC, "Error allocating memory");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
@ -128,7 +128,7 @@ int32_t MpmFactoryRegisterMpmCtxProfile(const char *name, uint8_t flags)
mpm_ctx_factory_container->items = items; mpm_ctx_factory_container->items = items;
MpmCtxFactoryItem *new_item = &items[mpm_ctx_factory_container->no_of_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) { if (new_item[0].name == NULL) {
SCLogError(SC_ERR_MEM_ALLOC, "Error allocating memory"); SCLogError(SC_ERR_MEM_ALLOC, "Error allocating memory");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);

@ -57,9 +57,9 @@ void SCProtoNameInit()
char *cname = strtok_r(NULL, " \t", &ptr); char *cname = strtok_r(NULL, " \t", &ptr);
if (cname != NULL) { if (cname != NULL) {
known_proto[proto] = strdup(cname); known_proto[proto] = SCStrdup(cname);
} else { } else {
known_proto[proto] = strdup(name); known_proto[proto] = SCStrdup(name);
} }
} }
fclose(fp); fclose(fp);

Loading…
Cancel
Save