Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix memory leak in snippetting

I love valgrind.
  • Loading branch information...
commit 3121b2ce0e28ebd1b27bca8ef38e5a3394d02b82 1 parent 322073e
@wmorgan authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 snippeter.c
View
4 snippeter.c
@@ -2,7 +2,7 @@
#include "tokenizer.lex.h"
typedef struct pword {
- const char* token;
+ char* token;
pos_t start;
pos_t end;
} pword;
@@ -92,6 +92,8 @@ RAISING_STATIC(snippetize_from_lexer(wp_query* query, lexinfo* charpos, yyscan_t
}
RELAY_ERROR(snippetize_query(query, field, words, max_num_results, num_results, start_offsets, end_offsets));
+ for(uint32_t i = 0; i < RARRAY_NELEM(words); i++) free(RARRAY_GET(words, i).token);
+ RARRAY_FREE(pword, words);
return NO_ERROR;
}
Please sign in to comment.
Something went wrong with that request. Please try again.