commit 9efa7b7aecf438a367ad0799ff9528a606398910 from: Omar Polo date: Thu Jul 22 18:40:28 2021 UTC fix pointer to t_backend this way the backend gets copied in the stack. Later, when the function returns t->t_backend is thus invalid. commit - d82b9f6db6cc472987d2dd332b0920fd8dd205ae commit + 9efa7b7aecf438a367ad0799ff9528a606398910 blob - 99669fa4b4f029b50bd79d2407004fdd377a6041 blob + 46f79945461551c274bd43dde06e15bdfd42d004 --- table.c +++ table.c @@ -29,13 +29,14 @@ table_open(struct kd_conf *conf, const char *name, con { struct table *t; struct kd_tables_conf *entry; - struct table_backend backends[] = { - table_static, + struct table_backend *backends[] = { + &table_static, + NULL, }, *b; size_t i; - for (i = 0; i < sizeof(backends)/sizeof(backends[0]); ++i) { - b = &backends[i]; + for (i = 0; backends[i] != NULL; ++i) { + b = backends[i]; if (!strcmp(type, b->name)) goto found; }