summaryrefslogtreecommitdiff
path: root/src/analysis/binary.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-09-12 21:44:24 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-09-12 21:44:38 (GMT)
commit682159e73cfbf8ec61d2f2aba765be1016a30ded (patch)
tree9477af8765263667b20a48c53835aa9b3be73a2a /src/analysis/binary.c
parent57f6179e22f880bbcff031714e8576cf9bd488ac (diff)
Extended the Python API for update databases.
Diffstat (limited to 'src/analysis/binary.c')
-rw-r--r--src/analysis/binary.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index ac7556c..822510c 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -995,7 +995,7 @@ GHubClient *g_loaded_binary_get_client(const GLoadedBinary *binary, bool interna
* *
******************************************************************************/
-GDbCollection **g_loaded_binary_get_all_collections(const GLoadedBinary *binary, size_t *count)
+GDbCollection **g_loaded_binary_get_collections(const GLoadedBinary *binary, size_t *count)
{
GDbCollection **result; /* Liste à retourner */
GList *c; /* Boucle de parcours #1 */
@@ -1003,14 +1003,21 @@ GDbCollection **g_loaded_binary_get_all_collections(const GLoadedBinary *binary,
*count = g_list_length(binary->collections);
- result = malloc(*count * sizeof(GDbCollection *));
+ if (*count == 0)
+ result = NULL;
- for (c = g_list_first(binary->collections), i = 0; c != NULL; c = g_list_next(c), i++)
+ else
{
- assert(i < *count);
+ result = malloc(*count * sizeof(GDbCollection *));
- result[i] = G_DB_COLLECTION(c->data);
- g_object_ref(G_OBJECT(result[i]));
+ for (c = g_list_first(binary->collections), i = 0; c != NULL; c = g_list_next(c), i++)
+ {
+ assert(i < *count);
+
+ result[i] = G_DB_COLLECTION(c->data);
+ g_object_ref(G_OBJECT(result[i]));
+
+ }
}