Skip to content

Commit f626c29

Browse files
committed
Don't leak.
1 parent 5025478 commit f626c29

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/6model/serialization.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,6 +1177,7 @@ static void check_and_disect_input(PARROT_INTERP, SerializationReader *reader, S
11771177
if (data == NULL)
11781178
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
11791179
"Failed to decode base64-encoded serialization data");
1180+
reader->data = data;
11801181

11811182
/* Ensure that we have enough space to read a version number and check it. */
11821183
if (data_len < 4)
@@ -1581,5 +1582,6 @@ void Serialization_deserialize(PARROT_INTERP, PMC *sc, PMC *string_heap, PMC *st
15811582
Parrot_unblock_GC_mark(interp);
15821583

15831584
/* Clear up afterwards. */
1585+
mem_sys_free(reader->data);
15841586
mem_sys_free(reader);
15851587
}

src/6model/serialization.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ typedef struct SerializationReader {
8282
STRING * (*read_str) (PARROT_INTERP, struct SerializationReader *reader);
8383
PMC * (*read_ref) (PARROT_INTERP, struct SerializationReader *reader);
8484
STable * (*read_stable_ref) (PARROT_INTERP, struct SerializationReader *reader);
85+
86+
/* The data, which we'll want to free after deserialization. */
87+
char *data;
8588
} SerializationReader;
8689

8790
/* Represents the serialization writer and the various functions available

0 commit comments

Comments
 (0)