comparison audioDB.cpp @ 391:69f8bf88c0ff api-inversion

close the database returned from audiodb_create() inside audioDB::create Now valgrind --leak-check=full agrees that we don't leak memory on create in the no-error path! Yay!!
author mas01cr
date Mon, 24 Nov 2008 12:50:38 +0000
parents f6aa8c5cd865
children 78fed0d4c108
comparison
equal deleted inserted replaced
390:f20571eeb9a6 391:69f8bf88c0ff
842 dbH->flags |= O2_FLAG_POWER; 842 dbH->flags |= O2_FLAG_POWER;
843 memcpy(db, dbH, O2_HEADERSIZE); 843 memcpy(db, dbH, O2_HEADERSIZE);
844 } 844 }
845 845
846 void audioDB::create(const char *dbName) { 846 void audioDB::create(const char *dbName) {
847 if(!audiodb_create(dbName, datasize, ntracks, datadim)) { 847 adb_t *adb;
848 if(!(adb = audiodb_create(dbName, datasize, ntracks, datadim))) {
848 error("Failed to create database file", dbName, ""); 849 error("Failed to create database file", dbName, "");
849 } 850 }
851 audiodb_close(adb);
850 } 852 }
851 853
852 // Unit norm block of features 854 // Unit norm block of features
853 855
854 /* FIXME: in fact this does not unit norm a block of features, it just 856 /* FIXME: in fact this does not unit norm a block of features, it just