diff options
author | Richard Hughes <richard@hughsie.com> | 2008-06-29 17:32:19 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2008-06-29 17:32:19 +0100 |
commit | 82692a3772e5a18d3202cd09db759054ac9a5e52 (patch) | |
tree | eaefb080c8d12216d9ffb46163bd86add4e5c677 /librazor/transaction.c | |
parent | 7f5f0c6a4aedbe3c5760545a924e2d151f0b68bc (diff) |
protect all exported functions by checking the input parameters for NULL input
Diffstat (limited to 'librazor/transaction.c')
-rw-r--r-- | librazor/transaction.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/librazor/transaction.c b/librazor/transaction.c index 0e8342d..11ccc74 100644 --- a/librazor/transaction.c +++ b/librazor/transaction.c @@ -32,6 +32,7 @@ #include <errno.h> #include <ctype.h> #include <fnmatch.h> +#include <assert.h> #include "razor-internal.h" #include "razor.h" @@ -188,6 +189,9 @@ RAZOR_EXPORT void razor_transaction_install_package(struct razor_transaction *trans, struct razor_package *package) { + assert (trans != NULL); + assert (package != NULL); + transaction_set_install_package(&trans->upstream, package); trans->changes++; } @@ -196,6 +200,9 @@ RAZOR_EXPORT void razor_transaction_remove_package(struct razor_transaction *trans, struct razor_package *package) { + assert (trans != NULL); + assert (package != NULL); + transaction_set_remove_package(&trans->system, package); trans->changes++; } @@ -206,6 +213,9 @@ razor_transaction_update_package(struct razor_transaction *trans, { struct razor_package *spkgs, *upkgs, *end; + assert (trans != NULL); + assert (package != NULL); + spkgs = trans->system.set->packages.data; upkgs = trans->upstream.set->packages.data; end = trans->system.set->packages.data + @@ -532,6 +542,8 @@ razor_transaction_update_all(struct razor_transaction *trans) struct razor_package *p; int i, count; + assert (trans != NULL); + count = trans->system.set->packages.size / sizeof *p; for (i = 0; i < count; i++) trans->system.packages[i] |= TRANS_PACKAGE_UPDATE; @@ -868,6 +880,8 @@ razor_transaction_finish(struct razor_transaction *trans) RAZOR_EXPORT void razor_transaction_destroy(struct razor_transaction *trans) { + assert (trans != NULL); + transaction_set_release(&trans->system); transaction_set_release(&trans->upstream); free(trans); |