mirror of https://github.com/python/cpython
gh-125234: Make PyInitConfig_Free(NULL) a no-op (#125266)
This commit is contained in:
parent
92af191a6a
commit
546dddca43
|
@ -1621,6 +1621,8 @@ Create Config
|
||||||
|
|
||||||
Free memory of the initialization configuration *config*.
|
Free memory of the initialization configuration *config*.
|
||||||
|
|
||||||
|
If *config* is ``NULL``, no operation is performed.
|
||||||
|
|
||||||
|
|
||||||
Error Handling
|
Error Handling
|
||||||
--------------
|
--------------
|
||||||
|
|
|
@ -1896,6 +1896,7 @@ static int test_initconfig_api(void)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
PyInitConfig_Free(config);
|
PyInitConfig_Free(config);
|
||||||
|
PyInitConfig_Free(NULL);
|
||||||
|
|
||||||
dump_config();
|
dump_config();
|
||||||
Py_Finalize();
|
Py_Finalize();
|
||||||
|
|
|
@ -3457,6 +3457,9 @@ PyInitConfig_Create(void)
|
||||||
void
|
void
|
||||||
PyInitConfig_Free(PyInitConfig *config)
|
PyInitConfig_Free(PyInitConfig *config)
|
||||||
{
|
{
|
||||||
|
if (config == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
free(config->err_msg);
|
free(config->err_msg);
|
||||||
free(config);
|
free(config);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue