parser.c (goaccess-1.6.5) | : | parser.c (goaccess-1.7) | ||
---|---|---|---|---|
skipping to change at line 209 | skipping to change at line 209 | |||
time_t now = time (0); | time_t now = time (0); | |||
GLogItem *logitem; | GLogItem *logitem; | |||
glog->items = xmalloc (sizeof (GLogItem)); | glog->items = xmalloc (sizeof (GLogItem)); | |||
logitem = glog->items; | logitem = glog->items; | |||
memset (logitem, 0, sizeof *logitem); | memset (logitem, 0, sizeof *logitem); | |||
logitem->agent = NULL; | logitem->agent = NULL; | |||
logitem->browser = NULL; | logitem->browser = NULL; | |||
logitem->browser_type = NULL; | logitem->browser_type = NULL; | |||
logitem->continent = NULL; | logitem->continent = NULL; | |||
logitem->asn = NULL; | ||||
logitem->country = NULL; | logitem->country = NULL; | |||
logitem->date = NULL; | logitem->date = NULL; | |||
logitem->errstr = NULL; | logitem->errstr = NULL; | |||
logitem->host = NULL; | logitem->host = NULL; | |||
logitem->keyphrase = NULL; | logitem->keyphrase = NULL; | |||
logitem->method = NULL; | logitem->method = NULL; | |||
logitem->os = NULL; | logitem->os = NULL; | |||
logitem->os_type = NULL; | logitem->os_type = NULL; | |||
logitem->protocol = NULL; | logitem->protocol = NULL; | |||
logitem->qstr = NULL; | logitem->qstr = NULL; | |||
skipping to change at line 255 | skipping to change at line 256 | |||
static void | static void | |||
free_glog (GLogItem * logitem) { | free_glog (GLogItem * logitem) { | |||
if (logitem->agent != NULL) | if (logitem->agent != NULL) | |||
free (logitem->agent); | free (logitem->agent); | |||
if (logitem->browser != NULL) | if (logitem->browser != NULL) | |||
free (logitem->browser); | free (logitem->browser); | |||
if (logitem->browser_type != NULL) | if (logitem->browser_type != NULL) | |||
free (logitem->browser_type); | free (logitem->browser_type); | |||
if (logitem->continent != NULL) | if (logitem->continent != NULL) | |||
free (logitem->continent); | free (logitem->continent); | |||
if (logitem->asn != NULL) | ||||
free (logitem->asn); | ||||
if (logitem->country != NULL) | if (logitem->country != NULL) | |||
free (logitem->country); | free (logitem->country); | |||
if (logitem->date != NULL) | if (logitem->date != NULL) | |||
free (logitem->date); | free (logitem->date); | |||
if (logitem->errstr != NULL) | if (logitem->errstr != NULL) | |||
free (logitem->errstr); | free (logitem->errstr); | |||
if (logitem->host != NULL) | if (logitem->host != NULL) | |||
free (logitem->host); | free (logitem->host); | |||
if (logitem->keyphrase != NULL) | if (logitem->keyphrase != NULL) | |||
free (logitem->keyphrase); | free (logitem->keyphrase); | |||
skipping to change at line 1127 | skipping to change at line 1130 | |||
/* user agent */ | /* user agent */ | |||
case 'u': | case 'u': | |||
if (logitem->agent) | if (logitem->agent) | |||
return 0; | return 0; | |||
tkn = parse_string (&(*str), end, 1); | tkn = parse_string (&(*str), end, 1); | |||
if (tkn != NULL && *tkn != '\0') { | if (tkn != NULL && *tkn != '\0') { | |||
/* Make sure the user agent is decoded (i.e.: CloudFront) */ | /* Make sure the user agent is decoded (i.e.: CloudFront) */ | |||
logitem->agent = decode_url (tkn); | logitem->agent = decode_url (tkn); | |||
set_browser_os(logitem); | set_browser_os (logitem); | |||
set_agent_hash (logitem); | set_agent_hash (logitem); | |||
free (tkn); | free (tkn); | |||
break; | break; | |||
} else if (tkn != NULL && *tkn == '\0') { | } else if (tkn != NULL && *tkn == '\0') { | |||
free (tkn); | free (tkn); | |||
tkn = alloc_string ("-"); | tkn = alloc_string ("-"); | |||
} | } | |||
/* must be null */ | /* must be null */ | |||
else { | else { | |||
tkn = alloc_string ("-"); | tkn = alloc_string ("-"); | |||
skipping to change at line 1900 | skipping to change at line 1903 | |||
while (1) { | while (1) { | |||
if (!fgets (buf, sizeof (buf), fp)) { | if (!fgets (buf, sizeof (buf), fp)) { | |||
if (conf.process_and_exit && errno == EAGAIN) { | if (conf.process_and_exit && errno == EAGAIN) { | |||
(void) nanosleep ((const struct timespec[]) { {0, 100000000L} }, NULL); | (void) nanosleep ((const struct timespec[]) { {0, 100000000L} }, NULL); | |||
continue; | continue; | |||
} else | } else | |||
break; | break; | |||
} | } | |||
if (*buf == '\0') | ||||
break; | ||||
len = strlen (buf); | len = strlen (buf); | |||
/* overflow check */ | /* overflow check */ | |||
if (SIZE_MAX - len - 1 < linelen) | if (SIZE_MAX - len - 1 < linelen) | |||
break; | break; | |||
if ((tmp = realloc (line, linelen + len + 1)) == NULL) | if ((tmp = realloc (line, linelen + len + 1)) == NULL) | |||
break; | break; | |||
line = tmp; | line = tmp; | |||
End of changes. 4 change blocks. | ||||
1 lines changed or deleted | 7 lines changed or added |