diff --git a/src/plugins/libdnf/product-id.c b/src/plugins/libdnf/product-id.c index 02f15f7ff5..ba69b75b91 100644 --- a/src/plugins/libdnf/product-id.c +++ b/src/plugins/libdnf/product-id.c @@ -21,11 +21,8 @@ #include #include -#include - #include #include -#include #include #include #include @@ -163,7 +160,7 @@ gchar *strHookId(PluginHookId id) { } } -RepoProductId *initRepoProductId() { +RepoProductId *initRepoProductId(void) { RepoProductId *repoProductId = (RepoProductId*) malloc(sizeof(RepoProductId)); repoProductId->repo = NULL; repoProductId->productIdPath = NULL; diff --git a/src/plugins/libdnf/product-id.h b/src/plugins/libdnf/product-id.h index 609749d2c0..71b4ee5764 100644 --- a/src/plugins/libdnf/product-id.h +++ b/src/plugins/libdnf/product-id.h @@ -68,7 +68,7 @@ typedef struct { bool isInstalled; } RepoProductId; -RepoProductId *initRepoProductId(); +RepoProductId *initRepoProductId(void); void freeRepoProductId(RepoProductId *repoProductId); void printError(const char *msg, GError *err); void getEnabled(const GPtrArray *repos, GPtrArray *enabledRepos); diff --git a/src/plugins/libdnf/productdb.c b/src/plugins/libdnf/productdb.c index f7a523ae94..0de6906b49 100644 --- a/src/plugins/libdnf/productdb.c +++ b/src/plugins/libdnf/productdb.c @@ -101,6 +101,7 @@ void readProductDb(ProductDb *productDb, GError **err) { if (repoIds == NULL) { *err = g_error_new_literal(quark, 0, error_string); g_free(productId); + json_object_put(dbJson); return; } GSList *repoList = NULL; @@ -109,6 +110,7 @@ void readProductDb(ProductDb *productDb, GError **err) { if (idArray == NULL) { *err = g_error_new_literal(quark, 0, error_string); g_free(productId); + json_object_put(dbJson); return; } int len = array_list_length(idArray); @@ -119,6 +121,7 @@ void readProductDb(ProductDb *productDb, GError **err) { if (repoId == NULL) { *err = g_error_new_literal(quark, 0, error_string); g_free(productId); + json_object_put(dbJson); return; } repoList = g_slist_prepend(repoList, (gpointer) repoId); diff --git a/src/plugins/libdnf/test-product-id.c b/src/plugins/libdnf/test-product-id.c index e7dc99e29f..51bf814ccd 100644 --- a/src/plugins/libdnf/test-product-id.c +++ b/src/plugins/libdnf/test-product-id.c @@ -13,7 +13,6 @@ * in this software or its documentation. */ -#include #include #include #include diff --git a/src/plugins/libdnf/test-productdb.c b/src/plugins/libdnf/test-productdb.c index 8369029c9a..3c708c4ec6 100644 --- a/src/plugins/libdnf/test-productdb.c +++ b/src/plugins/libdnf/test-productdb.c @@ -14,7 +14,6 @@ */ #include -#include #include #include @@ -180,6 +179,8 @@ void testReadCorruptedFile(dbFixture *fixture, gconstpointer ignored) { g_assert_nonnull(err); g_clear_error(&err); g_assert_cmpint(g_hash_table_size(db->repoMap), ==, 0); + g_free(path); + g_object_unref(testJsonFile); } void testReadFileWrongData(dbFixture *fixture, gconstpointer ignored) { @@ -223,6 +224,8 @@ void testReadFileWrongData(dbFixture *fixture, gconstpointer ignored) { g_clear_error(&err); g_io_stream_close((GIOStream*) ioStream, NULL, &err); + g_free(path); + g_object_unref(testJsonFile); } void testWriteFile(dbFixture *fixture, gconstpointer ignored) {