add missing error checking for various allocations Bug: None Test: `make check` passes Change-Id: I4a60cca7167b61f61e2987a1c2bff05b53b31238
diff --git a/util.c b/util.c index 48c3059..7cee515 100644 --- a/util.c +++ b/util.c
@@ -434,7 +434,8 @@ /* One extra char for '/' and one for '\0', hence + 2. */ pathlen = strlen(external_path) + strlen(internal_path) + 2; path = malloc(pathlen); - snprintf(path, pathlen, "%s/%s", external_path, internal_path); + if (path) + snprintf(path, pathlen, "%s/%s", external_path, internal_path); return path; }