Mercurial > hg > audiodb
view power.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 | 7038f31124d1 |
children |
line wrap: on
line source
#include "audioDB.h" extern "C" { #include "audioDB_API.h" #include "audioDB-internals.h" } int audiodb_power(adb_t *adb) { if(!(adb->flags & O_RDWR)) { return 1; } if(adb->header->length > 0) { return 1; } adb->header->flags |= O2_FLAG_POWER; return audiodb_sync_header(adb); }