diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2015-03-03 00:04:04 -0800 |
---|---|---|
committer | Patrick Ohly <patrick.ohly@intel.com> | 2015-03-03 00:05:47 -0800 |
commit | 4e9384f5c6bc3da80435ba15301f9b6e2db9bf0c (patch) | |
tree | 8171bceeb83cacf2378e8115d1bee16d720469ca | |
parent | f13106e145b806c4b792ace4457e217ff1b5ea4c (diff) |
DLL API: fix potential va_start leak
va_start() may allocate resources and thus has to be matched by
va_end(). Found with cppcheck 1.67.
-rwxr-xr-x | src/DB_interfaces/api_db/DLL_interface.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/DB_interfaces/api_db/DLL_interface.cpp b/src/DB_interfaces/api_db/DLL_interface.cpp index d686dfb..9e173f2 100755 --- a/src/DB_interfaces/api_db/DLL_interface.cpp +++ b/src/DB_interfaces/api_db/DLL_interface.cpp @@ -208,7 +208,7 @@ TSyError ConnectFunctions( appPointer aMod, appPointer aField, memSize aFieldSiz m++; } // while - if (err) return err; + if (err) goto done; // check if table is too small or too long while (ii*sizeof(p)<aFieldSize) { @@ -220,9 +220,10 @@ TSyError ConnectFunctions( appPointer aMod, appPointer aField, memSize aFieldSiz } // while tooMany= (p!=NULL); - va_end( args ); - if (notEnough || tooMany) return LOCERR_WRONGUSAGE; + if (notEnough || tooMany) err = LOCERR_WRONGUSAGE; + done: + va_end( args ); return err; } // ConnectFunctions |