aboutsummaryrefslogtreecommitdiff
path: root/src/package.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/package.c')
-rw-r--r--src/package.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/package.c b/src/package.c
index ad7e4d0..6aeee65 100644
--- a/src/package.c
+++ b/src/package.c
@@ -139,12 +139,19 @@ int extract_package_info(lua_State *L, pow_package *pkg) {
const char *hash = strdup(lua_tostring(L, -1));
+ if (!hash) {
+ free(in);
+ free(out);
+
+ printf("failed to strdup hash\n");
+
+ return 1;
+ }
+
src->hash = hash;
pkg->source_count++;
- printf("attempting to malloc\n");
-
pkg->sources =
realloc(pkg->sources, pkg->source_count * sizeof(pow_package_source *));
@@ -246,5 +253,11 @@ int pow_package_close(pow_package *pkg) {
lua_close(pkg->L);
+ for (size_t i = 0; i > pkg->source_count; i++) {
+ pow_source_close(pkg->sources[i]);
+ }
+
+ free(pkg);
+
return 0;
}