Skip to content

Commit

Permalink
Merge pull request #1 from pelias/patch
Browse files Browse the repository at this point in the history
add patchfile for expansion memory leak
  • Loading branch information
missinglink authored Sep 18, 2018
2 parents f8a5c05 + de50798 commit 33955ac
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@ RUN apt-get update && \
apt-get install -y autoconf automake libtool pkg-config python && \
rm -rf /var/lib/apt/lists/*

# install libpostal
# clone libpostal
RUN git clone https://github.com/openvenues/libpostal /code/libpostal
WORKDIR /code/libpostal

# patch libpostal
# https://github.com/pelias/interpolation/issues/132
COPY patchfile /tmp/patchfile
RUN git apply /tmp/patchfile

# install libpostal
RUN ./bootstrap.sh && \
./configure --datadir=/usr/share/libpostal && \
make && make check && make install && \
Expand Down
15 changes: 15 additions & 0 deletions patchfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/src/transliterate.c b/src/transliterate.c
index 7f5fff7..83e502b 100644
--- a/src/transliterate.c
+++ b/src/transliterate.c
@@ -938,7 +938,9 @@ char *transliterate(char *trans_name, char *str, size_t len) {
if (context_no_match && !prev_state.empty_transition && prev_state.phrase_len > 0) {
log_debug("Previous phrase stays as is %.*s\n", (int)prev_state.phrase_len, str+prev_state.phrase_start);
char_array_cat_len(new_str, str + prev_state.phrase_start, prev_state.phrase_len);
- state = start_state;
+ if (match_candidate_state.state != TRANS_STATE_PARTIAL_MATCH) {
+ state = start_state;
+ }
}

if (state.state == TRANS_STATE_BEGIN && !prev_state.empty_transition) {

0 comments on commit 33955ac

Please sign in to comment.