Skip to content

Commit e659c24

Browse files
author
Noam Preil
committed
Fix merging issue
1 parent 7460231 commit e659c24

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

common/objects.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ void set_area_metadata(area_t *area, const char *key, char *value, uint64_t valu
134134
newmeta->key = strdup(key);
135135
newmeta->value_length = value_length;
136136
if (dupe) {
137-
newmeta->value = strdup(value);
137+
newmeta->value = malloc(value_length);
138+
memcpy(newmeta->value, value, value_length);
138139
}
139140
else {
140141
newmeta->value = value;

linker/merge.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ void relocate_area(area_t *area, uint64_t address, bool immediates) {
5252
}
5353

5454
bool merge_areas(object_t *merged, object_t *source) {
55-
int i;
56-
for (i = 0; i < source->areas->length; ++i) {
55+
for (int i = 0; i < source->areas->length; ++i) {
5756
area_t *source_area = source->areas->items[i];
5857
area_t *merged_area = get_area_by_name(merged, source_area->name);
5958
if (merged_area == NULL) {

scas/main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,9 @@ int main(int argc, char **argv) {
280280
out = stdout;
281281
} else {
282282
out = fopen(scas_runtime.output_file, "w+");
283-
}
284-
if (!out) {
285-
scas_abort("Unable to open '%s' for output.", scas_runtime.output_file);
283+
if (!out) {
284+
scas_abort("Unable to open '%s' for output.", scas_runtime.output_file);
285+
}
286286
}
287287

288288
if ((scas_runtime.jobs & LINK) == LINK) {

0 commit comments

Comments
 (0)