Skip to content

Commit

Permalink
mx_mxql: Initialize s->func
Browse files Browse the repository at this point in the history
When we run into a (very unlikely) early error condition, the error
macros might output s->func. While glibc printf functions output
"(null)" if NULL is passed to "%s", this is not guaranteed.

For example, gcc transforms `printf("%s\n", ptr)` into `puts(ptr)`.
  • Loading branch information
donald committed May 5, 2022
1 parent 76175db commit c4b0945
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions mx_mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,7 @@ static int mx_mysql_statement_init(struct mx_mysql *mysql, struct mx_mysql_stmt
s = mx_calloc_forever(1, sizeof(*s));

s->mysql = mysql;
s->func = "";

do {
res = mx__mysql_stmt_init(s);
Expand Down

0 comments on commit c4b0945

Please sign in to comment.