Skip to content

Commit aa86a6a

Browse files
authored
Merge pull request #8161 from mjstapp/fix_sa_7_5_backports
[7.5]lib: Fix SA backports to 7.5
2 parents 13a8efb + 58911c6 commit aa86a6a

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

lib/clippy.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ int main(int argc, char **argv)
5151
#if PY_VERSION_HEX >= 0x03040000 /* 3.4 */
5252
Py_SetStandardStreamEncoding("UTF-8", NULL);
5353
#endif
54-
Py_SetProgramName(wconv(argv[0]));
54+
wchar_t *name = wconv(argv[0]);
55+
Py_SetProgramName(name);
5556
PyImport_AppendInittab("_clippy", command_py_init);
5657

5758
Py_Initialize();
@@ -67,6 +68,8 @@ int main(int argc, char **argv)
6768
fp = fopen(pyfile, "r");
6869
if (!fp) {
6970
fprintf(stderr, "%s: %s\n", pyfile, strerror(errno));
71+
72+
free(name);
7073
return 1;
7174
}
7275
} else {
@@ -85,6 +88,8 @@ int main(int argc, char **argv)
8588
if (PyRun_AnyFile(fp, pyfile)) {
8689
if (PyErr_Occurred())
8790
PyErr_Print();
91+
92+
free(name);
8893
return 1;
8994
}
9095
Py_Finalize();
@@ -93,6 +98,7 @@ int main(int argc, char **argv)
9398
for (int i = 1; i < argc; i++)
9499
free(wargv[i - 1]);
95100
#endif
101+
free(name);
96102
free(wargv);
97103
return 0;
98104
}

lib/defun_lex.l

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ static void extendbuf(char **what, const char *arg)
8080
}
8181
#define extend(x) extendbuf(&value, x)
8282

83+
#ifndef __clang_analyzer__
84+
8385
%}
8486

8587
ID [A-Za-z0-9_]+
@@ -157,6 +159,8 @@ SPECIAL [(),]
157159
158160
%%
159161
162+
#endif /* __clang_analyzer__ */
163+
160164
static int yylex_clr(char **retbuf)
161165
{
162166
int rv = def_yylex();

lib/northbound_cli.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,19 @@ void nb_cli_show_dnode_cmds(struct vty *vty, struct lyd_node *root,
595595
(*nb_node->cbs.cli_show_end)(vty, parent);
596596
}
597597

598+
/*
599+
* There is a possible path in this macro that ends up
600+
* dereferencing child->parent->parent. We just null checked
601+
* child->parent by checking (ly_iter_next_up(child) != NULL)
602+
* above.
603+
*
604+
* I am not sure whether it is possible for the other
605+
* conditions within this macro guarding the problem
606+
* dereference to be satisfied when child->parent == NULL.
607+
*/
608+
#ifndef __clang_analyzer__
598609
LY_TREE_DFS_END(root, next, child);
610+
#endif
599611
}
600612
}
601613

0 commit comments

Comments
 (0)