Skip to content

Commit a0aa9f3

Browse files
hpoettkerevanmiller
authored andcommitted
Reuse row buffer for SAS RDC decompression
1 parent 0dc2aee commit a0aa9f3

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

‎src/sas/readstat_sas7bdat_read.c‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -575,8 +575,8 @@ static readstat_error_t sas7bdat_parse_rows(const char *data, size_t len,
575575
static readstat_error_t sas7bdat_parse_subheader_rdc(const char *subheader, size_t len, sas7bdat_ctx_t *ctx) {
576576
readstat_error_t retval = READSTAT_OK;
577577
const unsigned char *input = (const unsigned char *)subheader;
578-
char *buffer = malloc(ctx->row_length);
579-
if (buffer == NULL) return READSTAT_ERROR_MALLOC;
578+
char *buffer = ctx->row;
579+
if (buffer == NULL) return READSTAT_ERROR_PARSE;
580580
char *output = buffer;
581581
while (input + 2 <= (const unsigned char *)subheader + len) {
582582
int i;
@@ -656,8 +656,6 @@ static readstat_error_t sas7bdat_parse_subheader_rdc(const char *subheader, size
656656
}
657657
retval = sas7bdat_parse_single_row(buffer, ctx);
658658
cleanup:
659-
free(buffer);
660-
661659
return retval;
662660
}
663661

0 commit comments

Comments
 (0)