]> diplodocus.org Git - nmh/blobdiff - sbr/m_getfld.c
Run output of -replacetextplain test through uniq.
[nmh] / sbr / m_getfld.c
index 07f4c0a518abce5117f199bc0b6e836ab03b1155..f19f7f11c632bdcf60b45d6b88f7a82ece92aaa8 100644 (file)
@@ -313,7 +313,10 @@ void m_getfld_state_destroy (m_getfld_state_t *gstate) {
     m_getfld_state_t s = *gstate;
 
     if (s) {
-       if (s->fdelim) free (s->fdelim-1);
+       if (s->fdelim) {
+           free (s->fdelim-1);
+           free (s->pat_map);
+       }
        free (s);
        *gstate = 0;
     }
@@ -632,7 +635,13 @@ m_getfld (m_getfld_state_t *gstate, char name[NAMESZ], char *buf, int *bufsz,
 
                if (c != EOF) c = Peek (s);
                if (max < n) {
-                   /* the dest buffer is full */
+                   /* The dest buffer is full.  Need to back the read
+                       pointer up by one because when m_getfld() is
+                       reentered, it will read a character.  Then
+                       we'll jump right to the FLDPLUS handling code,
+                       which will not store that character, but
+                       instead move on to the next one. */
+                    if (s->readpos > s->msg_buf) --s->readpos;
                    s->state = FLDPLUS;
                    finished = 1;
                } else if (c != ' '  &&  c != '\t') {