#ifdef DEBUG
if (SCLogDebugEnabled()) {
char *ext = SCMalloc(fileext->len + 1);
- memcpy(ext, fileext->ext, fileext->len);
- ext[fileext->len] = '\0';
- SCLogDebug("will look for fileext %s", ext);
+ if (ext != NULL) {
+ memcpy(ext, fileext->ext, fileext->len);
+ ext[fileext->len] = '\0';
+ SCLogDebug("will look for fileext %s", ext);
+ }
}
#endif
#ifdef DEBUG
if (SCLogDebugEnabled()) {
char *name = SCMalloc(filemagic->len + 1);
- memcpy(name, filemagic->name, filemagic->len);
- name[filemagic->len] = '\0';
- SCLogDebug("will look for filemagic %s", name);
+ if (name != NULL) {
+ memcpy(name, filemagic->name, filemagic->len);
+ name[filemagic->len] = '\0';
+ SCLogDebug("will look for filemagic %s", name);
+ }
}
#endif
#ifdef DEBUG
if (SCLogDebugEnabled()) {
char *name = SCMalloc(filemagic->len + 1);
- memcpy(name, filemagic->name, filemagic->len);
- name[filemagic->len] = '\0';
- SCLogDebug("will look for filemagic %s", name);
+ if (name != NULL) {
+ memcpy(name, filemagic->name, filemagic->len);
+ name[filemagic->len] = '\0';
+ SCLogDebug("will look for filemagic %s", name);
+ }
}
#endif
#ifdef DEBUG
if (SCLogDebugEnabled()) {
char *name = SCMalloc(filename->len + 1);
- memcpy(name, filename->name, filename->len);
- name[filename->len] = '\0';
- SCLogDebug("will look for filename %s", name);
+ if (name != NULL) {
+ memcpy(name, filename->name, filename->len);
+ name[filename->len] = '\0';
+ SCLogDebug("will look for filename %s", name);
+ }
}
#endif
#ifdef DEBUG
if (SCLogDebugEnabled()) {
char *name = SCMalloc(filename->len + 1);
- memcpy(name, filename->name, filename->len);
- name[filename->len] = '\0';
- SCLogDebug("will look for filename %s", name);
+ if (name != NULL) {
+ memcpy(name, filename->name, filename->len);
+ name[filename->len] = '\0';
+ SCLogDebug("will look for filename %s", name);
+ }
}
#endif
/* select the ptx image based on the compute capability supported by all
* devices (i.e. the lowest) */
char* image = SCMalloc(strlen(ptx_image)+15);
+ if (image == NULL) {
+ exit(EXIT_FAILURE);
+ }
memset(image, 0x0, sizeof(image));
int major = INT_MAX;
uint32_t u32 = 0;
if (size > 0) {
PoolBucket *pb = SCCalloc(size, sizeof(PoolBucket));
- p->pb_buffer = pb;
- if (pb == NULL)
+ if (unlikely(pb == NULL))
goto error;
+ p->pb_buffer = pb;
memset(pb, 0, size * sizeof(PoolBucket));
for (u32 = 0; u32 < size; u32++) {
/* populate pool */
void *PoolTestAlloc() {
void *ptr = SCMalloc(10);
+ if (ptr == NULL)
+ return NULL;
return ptr;
}
int PoolTestInitArg(void *data, void *allocdata) {
log_dir = DEFAULT_LOG_DIR;
profiling_file_name = SCMalloc(PATH_MAX);
+ if (profiling_file_name == NULL) {
+ SCLogError(SC_ERR_MEM_ALLOC, "can't duplicate file name");
+ exit(EXIT_FAILURE);
+ }
snprintf(profiling_file_name, PATH_MAX, "%s/%s", log_dir, filename);
const char *v = ConfNodeLookupChildValue(conf, "append");
log_dir = DEFAULT_LOG_DIR;
profiling_packets_file_name = SCMalloc(PATH_MAX);
+ if (profiling_packets_file_name == NULL) {
+ SCLogError(SC_ERR_MEM_ALLOC, "can't duplicate file name");
+ exit(EXIT_FAILURE);
+ }
+
snprintf(profiling_packets_file_name, PATH_MAX, "%s/%s", log_dir, filename);
const char *v = ConfNodeLookupChildValue(conf, "append");
log_dir = DEFAULT_LOG_DIR;
profiling_locks_file_name = SCMalloc(PATH_MAX);
+ if (profiling_locks_file_name == NULL) {
+ SCLogError(SC_ERR_MEM_ALLOC, "can't duplicate file name");
+ exit(EXIT_FAILURE);
+ }
+
snprintf(profiling_locks_file_name, PATH_MAX, "%s/%s", log_dir, filename);
const char *v = ConfNodeLookupChildValue(conf, "append");
{
if (overwrite || NULL == getenv(name)) {
char *str = SCMalloc(strlen(name) + strlen(value) + 2);
+ if (str == NULL)
+ return;
snprintf(str, strlen(name) + strlen(value) + 1, "%s=%s", name, value);
putenv(str);
SCFree(str);
void unsetenv(const char *name)
{
char *str = SCMalloc(strlen(name) + 2);
+ if (str == NULL)
+ return;
snprintf(str, strlen(name) + 1, "%s=", name);
putenv(str);
SCFree(str);