summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/be_sync.c
diff options
context:
space:
mode:
authorXavier Chantry <chantry.xavier@gmail.com>2010-10-31 21:39:31 +0100
committerDan McGee <dan@archlinux.org>2010-12-13 03:07:15 +0100
commitc2cce1f46a754c04c3623088a9e43922a6c10e2d (patch)
tree615ee055aa3f4c8ada883d800aeb7ddea036daf6 /lib/libalpm/be_sync.c
parent0e39cf9275c6a6f965e364792527c2704327bd02 (diff)
downloadpacman-c2cce1f46a754c04c3623088a9e43922a6c10e2d.tar.gz
pacman-c2cce1f46a754c04c3623088a9e43922a6c10e2d.tar.xz
Fix a few problems reported by clang-analyzer
One missing NULL-check and 3 dead assignments. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/be_sync.c')
-rw-r--r--lib/libalpm/be_sync.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
index e1c76638..851d7b83 100644
--- a/lib/libalpm/be_sync.c
+++ b/lib/libalpm/be_sync.c
@@ -129,7 +129,6 @@ int _alpm_sync_db_populate(pmdb_t *db)
int count = 0;
struct archive *archive;
struct archive_entry *entry;
- const char * archive_path;
ALPM_LOG_FUNC;
@@ -156,8 +155,6 @@ int _alpm_sync_db_populate(pmdb_t *db)
st = archive_entry_stat(entry);
if(S_ISDIR(st->st_mode)) {
- archive_path = archive_entry_pathname(entry);
-
pkg = _alpm_pkg_new();
if(pkg == NULL) {
archive_read_finish(archive);
@@ -204,7 +201,7 @@ int _alpm_sync_db_populate(pmdb_t *db)
int _alpm_sync_db_read(pmdb_t *db, struct archive *archive, struct archive_entry *entry)
{
char line[1024];
- const char *entryname;
+ const char *entryname = NULL;
char *filename, *pkgname, *p, *q;
pmpkg_t *pkg;
@@ -214,13 +211,14 @@ int _alpm_sync_db_read(pmdb_t *db, struct archive *archive, struct archive_entry
RET_ERR(PM_ERR_DB_NULL, -1);
}
- if(entry == NULL) {
+ if(entry != NULL) {
+ entryname = archive_entry_pathname(entry);
+ }
+ if(entryname == NULL) {
_alpm_log(PM_LOG_DEBUG, "invalid archive entry provided to _alpm_sync_db_read, skipping\n");
return(-1);
}
- entryname = archive_entry_pathname(entry);
-
_alpm_log(PM_LOG_FUNCTION, "loading package data from archive entry %s\n",
entryname);