Skip to content

Commit

Permalink
Don't leak.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Feb 27, 2012
1 parent 5025478 commit f626c29
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/6model/serialization.c
Original file line number Diff line number Diff line change
Expand Up @@ -1177,6 +1177,7 @@ static void check_and_disect_input(PARROT_INTERP, SerializationReader *reader, S
if (data == NULL)
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
"Failed to decode base64-encoded serialization data");
reader->data = data;

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

/* Clear up afterwards. */
mem_sys_free(reader->data);
mem_sys_free(reader);
}
3 changes: 3 additions & 0 deletions src/6model/serialization.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ typedef struct SerializationReader {
STRING * (*read_str) (PARROT_INTERP, struct SerializationReader *reader);
PMC * (*read_ref) (PARROT_INTERP, struct SerializationReader *reader);
STable * (*read_stable_ref) (PARROT_INTERP, struct SerializationReader *reader);

/* The data, which we'll want to free after deserialization. */
char *data;
} SerializationReader;

/* Represents the serialization writer and the various functions available
Expand Down

0 comments on commit f626c29

Please sign in to comment.