xbps-checkvars: add missing assertions after memory allocations

This commit is contained in:
Giedrius Statkevičius 2015-05-10 21:17:39 +03:00
parent b22d557287
commit fe3cb72a5b

View File

@ -145,6 +145,7 @@ map_add_n(map_t *map, const char *k, size_t kn, const char *v, size_t vn)
map->size += 16; map->size += 16;
map->items = realloc(map->items, map->items = realloc(map->items,
sizeof(map_item_t)*(map->size)); sizeof(map_item_t)*(map->size));
assert(map->items);
for (i = map->size - 10; i < map->size; i++) { for (i = map->size - 10; i < map->size; i++) {
map->items[i] = map_new_item(); map->items[i] = map_new_item();
} }
@ -523,6 +524,7 @@ check_reverts(const char *repover, const map_item_t reverts)
return rv; return rv;
sreverts = calloc(reverts.v.len+1, sizeof(char)); sreverts = calloc(reverts.v.len+1, sizeof(char));
assert(sreverts);
strncpy(sreverts, reverts.v.s, reverts.v.len); strncpy(sreverts, reverts.v.s, reverts.v.len);
sreverts[reverts.v.len] = '\0'; sreverts[reverts.v.len] = '\0';