diff --git a/src/pkg-idna.c b/src/pkg-idna.c index f243ddd..21ca9b1 100644 --- a/src/pkg-idna.c +++ b/src/pkg-idna.c @@ -137,6 +137,7 @@ f_idna_stringprep (svalue_t *sp) /* Get and check the flags. */ { p_uint argflags = (p_uint)sp->u.number; + sp--; if (argflags > (STRINGPREP_FLAG_MAX << 1)-1 || argflags & (STRINGPREP_NO_NFKC_FLAG | STRINGPREP_NO_BIDI_FLAG) @@ -151,12 +152,11 @@ f_idna_stringprep (svalue_t *sp) if (argflags & STRINGPREP_NO_NFKC_FLAG) flags |= STRINGPREP_NO_NFKC; if (argflags & STRINGPREP_NO_BIDI_FLAG) flags |= STRINGPREP_NO_BIDI; if (argflags & STRINGPREP_NO_UNASSIGNED_FLAG) flags |= STRINGPREP_NO_UNASSIGNED; - free_svalue(sp--); } /* Get and check the profile */ prof = (int)sp->u.number; - free_svalue(sp--); + sp--; /* select the profile */ switch(prof) @@ -214,12 +214,13 @@ f_idna_stringprep (svalue_t *sp) if (ret != STRINGPREP_OK) { - put_number(sp, -ret); errorf("stringprep(): Error %s", stringprep_strerror(ret)); /* NOTREACHED */ - } + } else { + // free the string argument + free_svalue(sp); put_c_string(sp, buf); }