Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fixes of libdnf plugins #3382

Merged
merged 4 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/plugins/libdnf/product-id.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,8 @@
#include <openssl/x509.h>
#include <openssl/err.h>

#include <json-c/json.h>

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <errno.h>
#include <zlib.h>
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/libdnf/product-id.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/libdnf/productdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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);
Expand Down
1 change: 0 additions & 1 deletion src/plugins/libdnf/test-product-id.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* in this software or its documentation.
*/

#include <stdlib.h>
#include <glib.h>
#include <stdio.h>
#include <gio/gio.h>
Expand Down
5 changes: 4 additions & 1 deletion src/plugins/libdnf/test-productdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
*/

#include <glib.h>
#include <stdio.h>
#include <gio/gio.h>
#include <string.h>

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
Loading