Displaying 1 result from an estimated 1 matches for "stats_event_t".
Did you mean:
stats_event
2011 Apr 29
4
You don't check for malloc failure
..._event (event);
@@ -462,6 +468,9 @@
break;
}
str = malloc (16);
+ if (str == NULL) {
+ abort();
+ }
snprintf (str, 16, "%d", value);
if (event->value == NULL)
event->value = strdup (str);
@@ -687,6 +696,10 @@
static stats_event_t *_make_event_from_node(stats_node_t *node, char *source)
{
stats_event_t *event = (stats_event_t *)malloc(sizeof(stats_event_t));
+
+ if (event == NULL) {
+ abort();
+ }
if (source != NULL)
event->source = (char *)strdup(source);
@@ -913,6 +926,9 @@
/* buil...