author | erik <erik> | 2007-01-26 20:18:07 (UTC) |
---|---|---|
committer | erik <erik> | 2007-01-26 20:18:07 (UTC) |
commit | 152a8fe978851aea8dac6ae5cb11f73540746b83 (patch) (side-by-side diff) | |
tree | 60f2fc2eb9a711e9aab91b9d743fd3730d5642e7 | |
parent | 644780047090442429342addb3fa97ec95bdc670 (diff) | |
download | opie-152a8fe978851aea8dac6ae5cb11f73540746b83.zip opie-152a8fe978851aea8dac6ae5cb11f73540746b83.tar.gz opie-152a8fe978851aea8dac6ae5cb11f73540746b83.tar.bz2 |
Both files in this commit exhibit use after free errors.
One of them was introduced in my memory leak fixing (whoops). I was freeing
a structure of stock data before one last call to it. So switching the free
to after that call fixed it.
The kcheckers.cpp fix is one where the game board could be deleted and then
a new one is not created because someone attempted to request a game board
type that is not supported. This is fixed by using the default directive for
one of the game board types in the switch statement. Which means it could
default to Russian boards. Score one for the Russians!
-rw-r--r-- | noncore/games/kcheckers/kcheckers.cpp | 1 | ||||
-rw-r--r-- | noncore/todayplugins/stockticker/libstocks/currency.c | 7 |
2 files changed, 4 insertions, 4 deletions
diff --git a/noncore/games/kcheckers/kcheckers.cpp b/noncore/games/kcheckers/kcheckers.cpp index a27dd18..433c68f 100644 --- a/noncore/games/kcheckers/kcheckers.cpp +++ b/noncore/games/kcheckers/kcheckers.cpp @@ -427,12 +427,13 @@ void KCheckers::newGame() case ENGLISH: game=new ECheckers(skill); CHECK_PTR(game); break; case RUSSIAN: + default: game=new RCheckers(skill); CHECK_PTR(game); } unselect(); gameOver=false; diff --git a/noncore/todayplugins/stockticker/libstocks/currency.c b/noncore/todayplugins/stockticker/libstocks/currency.c index e0090e2..82cd654 100644 --- a/noncore/todayplugins/stockticker/libstocks/currency.c +++ b/noncore/todayplugins/stockticker/libstocks/currency.c @@ -53,15 +53,14 @@ libstocks_return_code get_currency_exchange(char *from, error = get_stocks(symbol, &data); free(symbol); if (error) { *exchange = 0; - return(error); + return error; } - free_stocks(data); - *exchange = data->CurrentPrice; - return(error); + free_stocks(data); + return error; } |