summaryrefslogtreecommitdiffabout
path: root/src
Unidiff
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
@@ -2683,12 +2683,14 @@ static int
2683wordsplit_run (const char *command, size_t length, struct wordsplit *wsp, 2683wordsplit_run (const char *command, size_t length, struct wordsplit *wsp,
2684 int flags, int lvl) 2684 int flags, int lvl)
2685{ 2685{
2686 int rc; 2686 int rc;
2687 size_t start; 2687 size_t start;
2688 2688
2689 /* Initialize error context early */
2690 wsp->ws_errctx = NULL;
2689 if (!command) 2691 if (!command)
2690 { 2692 {
2691 if (!(flags & WRDSF_INCREMENTAL)) 2693 if (!(flags & WRDSF_INCREMENTAL))
2692 return _wsplt_seterr (wsp, WRDSE_USAGE); 2694 return _wsplt_seterr (wsp, WRDSE_USAGE);
2693 2695
2694 if (wsp->ws_head) 2696 if (wsp->ws_head)
@@ -2793,12 +2795,16 @@ wordsplit_clearerr (struct wordsplit *ws)
2793 ws->ws_errno = WRDSE_OK; 2795 ws->ws_errno = WRDSE_OK;
2794} 2796}
2795 2797
2796void 2798void
2797wordsplit_free (struct wordsplit *ws) 2799wordsplit_free (struct wordsplit *ws)
2798{ 2800{
2801 if (ws->ws_errno == WRDSE_USAGE)
2802 /* Usage error: the structure is not properly initialized and there's
2803 nothing to free. */
2804 return;
2799 wordsplit_clearerr (ws); 2805 wordsplit_clearerr (ws);
2800 wordsplit_free_nodes (ws); 2806 wordsplit_free_nodes (ws);
2801 wordsplit_free_words (ws); 2807 wordsplit_free_words (ws);
2802 free (ws->ws_wordv); 2808 free (ws->ws_wordv);
2803 ws->ws_wordv = NULL; 2809 ws->ws_wordv = NULL;
2804 wordsplit_free_envbuf (ws); 2810 wordsplit_free_envbuf (ws);

Return to:

Send suggestions and report system problems to the System administrator.