Commit 08e2e12a authored by Daniel Salzman's avatar Daniel Salzman

tests: fix possible NULL references in ypscheme (clang analyzer)

parent 1816a025
......@@ -79,6 +79,9 @@ int main(int argc, char *argv[])
yp_check_ctx_t *ctx = yp_scheme_check_init(scheme);
ok(ctx != NULL, "create check ctx");
if (ctx == NULL) {
goto skip_all;
}
/* Key0 test. */
str = "option: one";
......@@ -170,14 +173,21 @@ int main(int argc, char *argv[])
/* Scheme find tests. */
const yp_item_t *i = yp_scheme_find(C_OPT, NULL, scheme);
ok(i != NULL, "scheme find");
if (i == NULL) {
goto skip_all;
}
ok(strcmp(i->name + 1, "option") == 0, "name check");
i = yp_scheme_find(C_STR, C_GRP, scheme);
ok(i != NULL, "scheme find");
if (i == NULL) {
goto skip_all;
}
ok(strcmp(i->name + 1, "string") == 0, "name check");
yp_scheme_check_deinit(ctx);
yp_deinit(yp);
yp_scheme_free(scheme);
skip_all:
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment