Skip to content

Commit 234f4c0

Browse files
committed
Fix dangling pointers
1 parent 717ad9f commit 234f4c0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

prism/util/pm_string.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ pm_string_mapped_init(pm_string_t *string, const char *filepath) {
182182

183183
if (size == 0) {
184184
close(fd);
185-
const uint8_t source[] = "";
185+
static const uint8_t source[] = "";
186186
*string = (pm_string_t) { .type = PM_STRING_CONSTANT, .source = source, .length = 0 };
187187
return PM_STRING_INIT_SUCCESS;
188188
}
@@ -278,7 +278,7 @@ pm_string_file_init(pm_string_t *string, const char *filepath) {
278278
size_t size = (size_t) sb.st_size;
279279
if (size == 0) {
280280
close(fd);
281-
const uint8_t source[] = "";
281+
static const uint8_t source[] = "";
282282
*string = (pm_string_t) { .type = PM_STRING_CONSTANT, .source = source, .length = 0 };
283283
return PM_STRING_INIT_SUCCESS;
284284
}

0 commit comments

Comments
 (0)