commit ae70afec86c19b110a934f546c5586b2c9103393
parent 74b0a043aecb958886297e75a973d12d3785da57
Author: sin <sin@2f30.org>
Date: Tue, 17 Jun 2014 15:45:44 +0100
dp->d_name might be junk so do an estrdup()
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/db.c b/db.c
@@ -509,7 +509,7 @@ pkgnew(char *name)
struct pkg *pkg;
pkg = emalloc(sizeof(*pkg));
- pkg->name = name;
+ pkg->name = estrdup(name);
pkg->head = NULL;
return pkg;
}
@@ -525,5 +525,6 @@ pkgfree(struct pkg *pkg)
free(pe);
pe = tmp;
}
+ free(pkg->name);
free(pkg);
}