diff options
-rw-r--r-- | lib/libalpm/deps.c | 4 | ||||
-rw-r--r-- | lib/libalpm/sync.c | 4 | ||||
-rw-r--r-- | lib/libalpm/util.h | 2 | ||||
-rw-r--r-- | src/pacman/callback.c | 3 | ||||
-rw-r--r-- | src/pacman/conf.c | 3 |
5 files changed, 9 insertions, 7 deletions
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index f399083c..a9de1612 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -717,7 +717,7 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg, free(missdepstring); if(data) { if((miss = malloc(sizeof(pmdepmissing_t))) == NULL) { - _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes\n"), sizeof(pmdepmissing_t)); + _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %zd bytes\n"), sizeof(pmdepmissing_t)); FREELIST(*data); pm_errno = PM_ERR_MEMORY; goto error; @@ -748,7 +748,7 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg, _alpm_log(PM_LOG_ERROR, _("cannot resolve dependencies for \"%s\"\n"), miss->target); if(data) { if((miss = malloc(sizeof(pmdepmissing_t))) == NULL) { - _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes\n"), sizeof(pmdepmissing_t)); + _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %zd bytes\n"), sizeof(pmdepmissing_t)); FREELIST(*data); pm_errno = PM_ERR_MEMORY; goto error; diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 3e61c517..7791e74c 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -593,7 +593,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync errorout = 1; if(data) { if((miss = malloc(sizeof(pmdepmissing_t))) == NULL) { - _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes\n"), sizeof(pmdepmissing_t)); + _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %zd bytes\n"), sizeof(pmdepmissing_t)); FREELIST(*data); pm_errno = PM_ERR_MEMORY; ret = -1; @@ -609,7 +609,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync errorout = 1; if(data) { if((miss = malloc(sizeof(pmdepmissing_t))) == NULL) { - _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes\n"), sizeof(pmdepmissing_t)); + _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %zd bytes\n"), sizeof(pmdepmissing_t)); FREELIST(*data); pm_errno = PM_ERR_MEMORY; ret = -1; diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h index 3b8fd83d..e8b1d719 100644 --- a/lib/libalpm/util.h +++ b/lib/libalpm/util.h @@ -39,7 +39,7 @@ #define _(s) s #endif -#define ALLOC_FAIL(s) do { _alpm_log(PM_LOG_ERROR, _("alloc failure: could not allocate %d bytes\n"), s); } while(0) +#define ALLOC_FAIL(s) do { _alpm_log(PM_LOG_ERROR, _("alloc failure: could not allocate %zd bytes\n"), s); } while(0) #define MALLOC(p, s, action) do { p = calloc(1, s); if(p == NULL) { ALLOC_FAIL(s); action; } } while(0) #define CALLOC(p, l, s, action) do { p = calloc(l, s); if(p == NULL) { ALLOC_FAIL(s); action; } } while(0) diff --git a/src/pacman/callback.c b/src/pacman/callback.c index aec9753a..3061d2a0 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -396,8 +396,9 @@ void cb_trans_progress(pmtransprog_t event, const char *pkgname, int percent, oprlen = strlen(opr); wcopr = calloc(oprlen, sizeof(wchar_t)); if(!wcopr) { - fprintf(stderr, "malloc failure: could not allocate %d bytes\n", + fprintf(stderr, "malloc failure: could not allocate %zd bytes\n", strlen(opr) * sizeof(wchar_t)); + return; } oprlen = mbstowcs(wcopr, opr, oprlen); diff --git a/src/pacman/conf.c b/src/pacman/conf.c index 2bc69820..21256d77 100644 --- a/src/pacman/conf.c +++ b/src/pacman/conf.c @@ -32,8 +32,9 @@ config_t *config_new(void) { config_t *newconfig = calloc(1, sizeof(config_t)); if(!newconfig) { - fprintf(stderr, "malloc failure: could not allocate %d bytes\n", + fprintf(stderr, "malloc failure: could not allocate %zd bytes\n", sizeof(config_t)); + return(NULL); } /* defaults which may get overridden later */ newconfig->op = PM_OP_MAIN; |