changeset 507:e7fd50483311

Free bits of the datum constructed in audioDB::query. We're not quite safe: error calls between allocation of some of these bits and pieces and their use will cause failure... but not freeing things here is definitely wrong.
author mas01cr
date Tue, 13 Jan 2009 21:37:10 +0000
parents 33913e11348a
children 23c47e118bc6
files audioDB.cpp
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/audioDB.cpp	Tue Jan 13 21:37:06 2009 +0000
+++ b/audioDB.cpp	Tue Jan 13 21:37:10 2009 +0000
@@ -925,7 +925,21 @@
 
   adb_query_results_t *rs = audiodb_query_spec(adb, &qspec);
 
-  // FIXME: free bits of datum if !query_from_key
+  // FIXME: we don't yet free everything up if there are error
+  // conditions during the construction of the query spec (including
+  // the datum itself).
+  if(datum.data) {
+    free(datum.data);
+    datum.data = NULL;
+  }
+  if(datum.power) {
+    free(datum.data);
+    datum.data = NULL;
+  }
+  if(datum.times) {
+    free(datum.data);
+    datum.data = NULL;
+  }
 
   if(rs == NULL) {
     error("audiodb_query_spec failed");