ref: 4b53e7160f467835c7797453b408122069fd606b
parent: d31939822e9036f76e1534b1f77e3ab5507cb20b
author: Roberto E. Vargas Caballero <[email protected]>
date: Mon May 14 08:01:37 EDT 2018
[ld] Allow empty member name in newobj() This field is going to be empty when we load an object file.
--- a/ld/obj.c
+++ b/ld/obj.c
@@ -23,18 +23,18 @@
len = strlen(fname);
obj = malloc(sizeof(*obj));
- s = malloc(len+1);
+ s = malloc(len) + 1;
if (!obj || !s)
outmem();
- obj->fname = memcpy(s, fname, len+1);
+ obj->fname = memcpy(s, fname, len);
if (!member) {
obj->member = NULL;
} else {
- len = strlen(member);
- if ((s = malloc(len+1)) == NULL)
+ len = strlen(member) + 1;
+ if ((s = malloc(len)) == NULL)
outmem();
- obj->member = memcpy(s, member, len+1);
+ obj->member = memcpy(s, member, len);
}
obj->next = NULL;