TAILQ_HEAD(, candidate_word) words; /* List of subnodes */
TAILQ_INIT(&words);
current = cmdenv_top(&env);
- TAILQ_FOREACH(candidate, ¤t->subentries, next) {
- if ((!candidate->token || help ||
- !strncmp(env.argv[env.argc - 1], candidate->token,
- strlen(env.argv[env.argc -1 ]))) &&
- (!candidate->validate ||
- candidate->validate(&env, candidate->arg) == 1)) {
- struct candidate_word *cword = malloc(sizeof(struct candidate_word));
- if (!cword) break;
- cword->word = candidate->token;
- cword->doc = candidate->doc;
- if (cword->word && strlen(cword->word) > maxl)
- maxl = strlen(cword->word);
- TAILQ_INSERT_TAIL(&words, cword, next);
+ if (!TAILQ_EMPTY(¤t->subentries)) {
+ TAILQ_FOREACH(candidate, ¤t->subentries, next) {
+ if ((!candidate->token || help ||
+ !strncmp(env.argv[env.argc - 1], candidate->token,
+ strlen(env.argv[env.argc -1 ]))) &&
+ (!candidate->validate ||
+ candidate->validate(&env, candidate->arg) == 1)) {
+ struct candidate_word *cword =
+ malloc(sizeof(struct candidate_word));
+ if (!cword) break;
+ cword->word = candidate->token;
+ cword->doc = candidate->doc;
+ if (cword->word && strlen(cword->word) > maxl)
+ maxl = strlen(cword->word);
+ TAILQ_INSERT_TAIL(&words, cword, next);
+ }
}
}
if (!TAILQ_EMPTY(&words)) {
return 1;
malformed:
+#ifdef ENABLE_DOT1
free(lvlan);
+#endif
lldpd_chassis_cleanup(chassis, 1);
lldpd_port_cleanup(port, 1);
free(port);
int fd, char *buffer, size_t size)
{
int n;
- struct sockaddr_ll from;
+ struct sockaddr_ll from = {};
socklen_t fromlen;
log_debug("interfaces", "receive PDU from ethernet device %s",
int fd, char *buffer, size_t size)
{
int n;
- struct sockaddr_ll from;
+ struct sockaddr_ll from = {};
socklen_t fromlen;
struct bond_master *master = hardware->h_data;
char *hp;
log_debug("localchassis", "update information for local chassis");
+ assert(LOCAL_CHASSIS(cfg) != NULL);
/* Set system name and description */
if (uname(&un) != 0)
for (current = mi->pointers; current->mi; current++) {
size_t sublen;
void *source;
- void *target;
+ void *target = NULL;
if (current->kind == ignore) continue;
if (current->kind == pointer) {
memcpy(&source,
sublen = marshal_serialize_(current->mi,
source, &target,
current->kind == substruct, refs, osize);
- if (sublen == -1) {
+ if (sublen == -1 || target == NULL) {
log_warnx("marshal", "unable to serialize substructure %s for %s",
current->mi->name, mi->name);
+ free(target);
free(serialized);
return -1;
}
MARSHAL_END
/* Serialization */
-ssize_t marshal_serialize_(struct marshal_info *, void *, void **, int, void *, int);
+ssize_t marshal_serialize_(struct marshal_info *, void *, void **, int, void *, int)
+ __attribute__((nonnull (1, 2, 3) ));
#define marshal_serialize(type, o, output) marshal_serialize_(&MARSHAL_INFO(type), o, output, 0, NULL, 0)
/* Unserialization */
-size_t marshal_unserialize_(struct marshal_info *, void *, size_t, void **, void*, int, int);
+size_t marshal_unserialize_(struct marshal_info *, void *, size_t, void **, void*, int, int)
+ __attribute__((nonnull (1, 2, 4) ));
#define marshal_unserialize(type, o, l, input) \
marshal_unserialize_(&MARSHAL_INFO(type), o, l, input, NULL, 0, 0)