aboutsummaryrefslogtreecommitdiff
path: root/src/cli
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2026-04-29 12:41:28 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2026-05-11 15:50:47 -0400
commit081da8afbfbd808acecc1d3e54f89b90c625ee77 (patch)
tree56b6950d69aaee3109a4abe51dc5ee9b2ae89da2 /src/cli
parent77257cff9f84d6bfe15c352a00e1231d8984b46e (diff)
downloadstasis-081da8afbfbd808acecc1d3e54f89b90c625ee77.tar.gz
handle asprintf errors
Diffstat (limited to 'src/cli')
-rw-r--r--src/cli/stasis_indexer/helpers.c5
-rw-r--r--src/cli/stasis_indexer/readmes.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/src/cli/stasis_indexer/helpers.c b/src/cli/stasis_indexer/helpers.c
index 097b0ca..bf7efee 100644
--- a/src/cli/stasis_indexer/helpers.c
+++ b/src/cli/stasis_indexer/helpers.c
@@ -297,7 +297,10 @@ int get_files(struct StrList **out, const char *path, const char *pattern, ...)
struct StrList *get_docker_images(struct Delivery *ctx, char *pattern) {
char *tarball = NULL;
- asprintf(&tarball, "%s*.tar*", pattern);
+ if (asprintf(&tarball, "%s*.tar*", pattern) < 0) {
+ SYSERROR("unable to allocate bytes for tarball pattern: %s", pattern);
+ return NULL;
+ }
if (!tarball) {
SYSERROR("Unable to allocate bytes for docker image wildcard pattern");
return NULL;
diff --git a/src/cli/stasis_indexer/readmes.c b/src/cli/stasis_indexer/readmes.c
index de9e2f2..836df5c 100644
--- a/src/cli/stasis_indexer/readmes.c
+++ b/src/cli/stasis_indexer/readmes.c
@@ -101,10 +101,9 @@ int indexer_readmes(struct Delivery **ctx, const size_t nelem) {
fprintf(indexfp, "- Receipt: [STASIS input file](../config/%s.ini)\n", current->info.release_name);
char *pattern = NULL;
- asprintf(&pattern, "*%s*%s*",
+ if (asprintf(&pattern, "*%s*%s*",
current->info.build_number,
- strstr((*ctx)->rules.release_fmt, "%p") ? current->meta.python_compact : "" );
- if (!pattern) {
+ strstr((*ctx)->rules.release_fmt, "%p") ? current->meta.python_compact : "" ) < 0) {
SYSERROR("Unable to allocate bytes for pattern");
fclose(indexfp);
return -1;