summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--expac.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/expac.c b/expac.c
index 1ded409..eba37bd 100644
--- a/expac.c
+++ b/expac.c
@@ -140,7 +140,9 @@ static char *strtrim(char *str) {
static char *format_optdep(alpm_depend_t *optdep) {
char *out;
- asprintf(&out, "%s: %s", optdep->name, optdep->desc);
+ if (asprintf(&out, "%s: %s", optdep->name, optdep->desc) < 0) {
+ return NULL;
+ }
return out;
}
@@ -380,9 +382,10 @@ static int print_list(alpm_list_t *list, extractfn fn, bool shortdeps) {
i = list;
while (1) {
- char *item;
-
- item = (char*)(fn ? fn(i->data) : i->data);
+ char *item = (char*)(fn ? fn(i->data) : i->data);
+ if (item == NULL) {
+ continue;
+ }
if (shortdeps) {
*(item + strcspn(item, "<>=")) = '\0';