mirror of
https://github.com/python/cpython.git
synced 2024-11-24 00:38:00 +01:00
gh-120155: Fix Coverity issue in zoneinfo load_data() (#120232)
Declare the 'rv' varaible at the top of the load_data() function to make sure that it's initialized before the first 'goto error' which uses 'rv' (return rv). Fix the Coverity issue: Error: UNINIT (CWE-457): Python-3.12.2/Modules/_zoneinfo.c:1233:5: skipped_decl: Jumping over declaration of ""rv"". Python-3.12.2/Modules/_zoneinfo.c:1284:5: uninit_use: Using uninitialized value ""rv"". 1282| } 1283| 1284|-> return rv; 1285| } 1286|
This commit is contained in:
parent
4829522b8d
commit
b90bd3e5bb
@ -944,6 +944,7 @@ end:
|
||||
static int
|
||||
load_data(zoneinfo_state *state, PyZoneInfo_ZoneInfo *self, PyObject *file_obj)
|
||||
{
|
||||
int rv = 0;
|
||||
PyObject *data_tuple = NULL;
|
||||
|
||||
long *utcoff = NULL;
|
||||
@ -1220,7 +1221,6 @@ load_data(zoneinfo_state *state, PyZoneInfo_ZoneInfo *self, PyObject *file_obj)
|
||||
}
|
||||
}
|
||||
|
||||
int rv = 0;
|
||||
goto cleanup;
|
||||
error:
|
||||
// These resources only need to be freed if we have failed, if we succeed
|
||||
|
Loading…
Reference in New Issue
Block a user