# fix: Prevent segfault when using add.Module\(\) · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/280140595fcfe9676ed32a7906eb7958a4c595b1)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 280140595fcfe9676ed32a7906eb7958a4c595b1

Requested commit: 280140595fcfe9676ed32a7906eb7958a4c595b1

Commit: 280140595fcfe9676ed32a7906eb7958a4c595b1

Tree: 8df25bbd8a24970749382cd2aaf4bc092e84c20c

Author: Daniel A.C\. Martin

Committer: Andrew Kelley

## Message

```
fix: Prevent segfault when using add.Module()

This duplicates the source file string (as is done in other places such
as `addAssemblyFile()`) in order to prevent a segfault when the supplied
string is freed by the caller. This is still seen when the caller makes
use of a defer statement.

```

## Parents

- [f29302f9152a0c15641596c148a2d784991fe7d8](https://git.cafe/gitcafe/zig/commit/f29302f9152a0c15641596c148a2d784991fe7d8?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/280140595fcfe9676ed32a7906eb7958a4c595b1?format=markdown)
