summaryrefslogtreecommitdiffabout
path: root/src
Side-by-side diff
Diffstat (limited to 'src') (more/less context) (ignore whitespace changes)
-rw-r--r--src/wordsplit.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/wordsplit.c b/src/wordsplit.c
index 48312bb..b38dde4 100644
--- a/src/wordsplit.c
+++ b/src/wordsplit.c
@@ -2685,8 +2685,10 @@ wordsplit_run (const char *command, size_t length, struct wordsplit *wsp,
{
int rc;
size_t start;
+ /* Initialize error context early */
+ wsp->ws_errctx = NULL;
if (!command)
{
if (!(flags & WRDSF_INCREMENTAL))
return _wsplt_seterr (wsp, WRDSE_USAGE);
@@ -2795,8 +2797,12 @@ wordsplit_clearerr (struct wordsplit *ws)
void
wordsplit_free (struct wordsplit *ws)
{
+ if (ws->ws_errno == WRDSE_USAGE)
+ /* Usage error: the structure is not properly initialized and there's
+ nothing to free. */
+ return;
wordsplit_clearerr (ws);
wordsplit_free_nodes (ws);
wordsplit_free_words (ws);
free (ws->ws_wordv);

Return to:

Send suggestions and report system problems to the System administrator.