Code

utils dbi: Use sdb_data_free_datum().
authorSebastian Harl <sh@tokkee.org>
Wed, 29 Jan 2014 20:42:09 +0000 (21:42 +0100)
committerSebastian Harl <sh@tokkee.org>
Wed, 29 Jan 2014 20:42:09 +0000 (21:42 +0100)
src/utils/dbi.c

index c8eb81616454a3078eb768f16b1affd32b81f1d9..a30f548db2c6661242970d5db6c639b93aa480c8 100644 (file)
@@ -155,13 +155,8 @@ sdb_dbi_get_data(sdb_dbi_client_t *client, dbi_result res,
                                continue;
 
                status = callback(client, num_fields, data, user_data);
-               for (i = 0; i < num_fields; ++i) {
-                       if ((data[i].type == SDB_TYPE_STRING) && (data[i].data.string))
-                               free(data[i].data.string);
-                       else if ((data[i].type == SDB_TYPE_BINARY)
-                                       && (data[i].data.binary.datum))
-                               free(data[i].data.binary.datum);
-               }
+               for (i = 0; i < num_fields; ++i)
+                       sdb_data_free_datum(&data[i]);
 
                if (status)
                        continue;