*
* Copyright (c) 2005 Adi Zaimi, Dan Piponi <dan@tanelorn.demon.co.uk>,
* Dave Clark <clarkd@skynet.ca>
- * Copyright (c) 2005-2009 Brenden Matthews, Philip Kovacs, et. al.
+ * Copyright (c) 2005-2010 Brenden Matthews, Philip Kovacs, et. al.
* (see AUTHORS)
* All rights reserved.
*
#else /* IOSTATS */
NORM_ERR("must be one of: name, cpu, pid, mem, time, mem_res, mem_vsize");
#endif /* IOSTATS */
+ free(td->s);
+ free(obj->data.opaque);
return 0;
}
if (n < 1 || n > 10) {
NORM_ERR("invalid num arg for top. Must be between 1 and 10.");
+ free(td->s);
+ free(obj->data.opaque);
return 0;
} else {
td->num = n - 1;
}
} else {
NORM_ERR("invalid argument count for top");
+ free(td->s);
+ free(obj->data.opaque);
return 0;
}
return 1;
switch (td->type) {
case TOP_NAME:
- width = MIN(p_max_size, (int)top_name_width + 1);
- snprintf(p, width + 1, "%-*s", width,
- needed[td->num]->name);
+ if (needed[td->num]->name) {
+ width = MIN(p_max_size, (int)top_name_width + 1);
+ snprintf(p, width + 1, "%-*s", width,
+ needed[td->num]->name);
+ }
break;
case TOP_CPU:
width = MIN(p_max_size, 7);