Skip to content

Handle asprintf failure in escape()#59

Merged
folkertvanheusden merged 1 commit into
folkertvanheusden:masterfrom
mikelolasagasti:asprintf-unused
Jan 2, 2026
Merged

Handle asprintf failure in escape()#59
folkertvanheusden merged 1 commit into
folkertvanheusden:masterfrom
mikelolasagasti:asprintf-unused

Conversation

@mikelolasagasti

Copy link
Copy Markdown
Contributor

Exit with error on allocation failure using error_exit().

Fixes the following warning:

/builddir/build/BUILD/multitail-7.1.5-build/multitail-7.1.5/mt.c: In function ‘escape’:
/builddir/build/BUILD/multitail-7.1.5-build/multitail-7.1.5/mt.c:770:17: warning: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  770 |                 asprintf(&new_str, "%s%s%s", temp, cur ->
filename, p + 2);
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Exit with error on allocation failure using error_exit().

Fixes the following warning:

/builddir/build/BUILD/multitail-7.1.5-build/multitail-7.1.5/mt.c: In
function ‘escape’:
/builddir/build/BUILD/multitail-7.1.5-build/multitail-7.1.5/mt.c:770:17:
warning: ignoring return value of ‘asprintf’ declared with attribute
‘warn_unused_result’ [-Wunused-result]
  770 |                 asprintf(&new_str, "%s%s%s", temp, cur ->
filename, p + 2);
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Mikel Olasagasti Uranga <mikel@olasagasti.info>
@folkertvanheusden folkertvanheusden merged commit 7af1ae4 into folkertvanheusden:master Jan 2, 2026
2 checks passed
@mikelolasagasti mikelolasagasti deleted the asprintf-unused branch January 2, 2026 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants