Skip to content

Commit

Permalink
Fix merging issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Noam Preil committed Jul 1, 2020
1 parent 7460231 commit e659c24
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
3 changes: 2 additions & 1 deletion common/objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ void set_area_metadata(area_t *area, const char *key, char *value, uint64_t valu
newmeta->key = strdup(key);
newmeta->value_length = value_length;
if (dupe) {
newmeta->value = strdup(value);
newmeta->value = malloc(value_length);
memcpy(newmeta->value, value, value_length);
}
else {
newmeta->value = value;
Expand Down
3 changes: 1 addition & 2 deletions linker/merge.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ void relocate_area(area_t *area, uint64_t address, bool immediates) {
}

bool merge_areas(object_t *merged, object_t *source) {
int i;
for (i = 0; i < source->areas->length; ++i) {
for (int i = 0; i < source->areas->length; ++i) {
area_t *source_area = source->areas->items[i];
area_t *merged_area = get_area_by_name(merged, source_area->name);
if (merged_area == NULL) {
Expand Down
6 changes: 3 additions & 3 deletions scas/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,9 @@ int main(int argc, char **argv) {
out = stdout;
} else {
out = fopen(scas_runtime.output_file, "w+");
}
if (!out) {
scas_abort("Unable to open '%s' for output.", scas_runtime.output_file);
if (!out) {
scas_abort("Unable to open '%s' for output.", scas_runtime.output_file);
}
}

if ((scas_runtime.jobs & LINK) == LINK) {
Expand Down

0 comments on commit e659c24

Please sign in to comment.