napatech: fix minor memleak in error path

pull/2944/head
Victor Julien 7 years ago
parent 72dd663e00
commit cf0a28bc6a

@ -123,15 +123,16 @@ static void *NapatechConfigParser(const char *device)
{
/* Expect device to be of the form nt%d where %d is the stream id to use */
int dev_len = strlen(device);
if (dev_len < 3 || dev_len > 5) {
SCLogError(SC_ERR_NAPATECH_PARSE_CONFIG, "Could not parse config for device: %s - invalid length", device);
return NULL;
}
struct NapatechStreamDevConf *conf = SCCalloc(1, sizeof (struct NapatechStreamDevConf));
if (unlikely(conf == NULL)) {
SCLogError(SC_ERR_MEM_ALLOC, "Failed to allocate memory for NAPATECH device name.");
return NULL;
}
if (dev_len < 3 || dev_len > 5) {
SCLogError(SC_ERR_NAPATECH_PARSE_CONFIG, "Could not parse config for device: %s - invalid length", device);
return NULL;
}
/* device+5 is a pointer to the beginning of the stream id after the constant nt portion */
conf->stream_id = atoi(device + 2);

Loading…
Cancel
Save