Mercurial > hg > audiodb
annotate close.cpp @ 411:ad2206c24986 api-inversion
Fix a memory corruption bug.
When allocating the adb_t in audiodb_open(), zero the memory; then we're
not going to try to free() or delete some arbitrary uninitialized thing
if the thing that we're opening turns out not to be an audiodb database.
author | mas01cr |
---|---|
date | Thu, 11 Dec 2008 08:54:06 +0000 |
parents | 58b88ab69424 |
children | 62a0515f59be |
rev | line source |
---|---|
mas01cr@392 | 1 #include "audioDB.h" |
mas01cr@392 | 2 extern "C" { |
mas01cr@392 | 3 #include "audioDB_API.h" |
mas01cr@402 | 4 #include "audioDB-internals.h" |
mas01cr@392 | 5 } |
mas01cr@392 | 6 |
mas01cr@392 | 7 void audiodb_close(adb_t *adb) { |
mas01cr@392 | 8 free(adb->path); |
mas01cr@392 | 9 free(adb->header); |
mas01cr@402 | 10 delete adb->keys; |
mas01cr@392 | 11 close(adb->fd); |
mas01cr@392 | 12 free(adb); |
mas01cr@392 | 13 } |