diff options
author | jh <jh@FreeBSD.org> | 2013-05-10 09:58:32 +0000 |
---|---|---|
committer | jh <jh@FreeBSD.org> | 2013-05-10 09:58:32 +0000 |
commit | 080f111dcbace394f7e22ba2d07553092dab6bad (patch) | |
tree | 15aa44864744c8f5a2533733ccb8f9add431eace | |
parent | 9bbb992f11f7ee6b33d4001b133e80dd0a041ac2 (diff) | |
download | FreeBSD-src-080f111dcbace394f7e22ba2d07553092dab6bad.zip FreeBSD-src-080f111dcbace394f7e22ba2d07553092dab6bad.tar.gz |
Check the return value of sbuf_finish().
MFC after: 1 week
-rw-r--r-- | usr.sbin/ctladm/ctladm.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/ctladm/ctladm.c b/usr.sbin/ctladm/ctladm.c index bfbedc7..17c1148 100644 --- a/usr.sbin/ctladm/ctladm.c +++ b/usr.sbin/ctladm/ctladm.c @@ -546,7 +546,8 @@ retry: } if (xml != 0) { sbuf_printf(sb, "</ctlfelist>\n"); - sbuf_finish(sb); + if (sbuf_finish(sb) != 0) + err(1, "%s: sbuf_finish", __func__); printf("%s", sbuf_data(sb)); sbuf_delete(sb); } @@ -3493,7 +3494,8 @@ cctl_end_element(void *user_data, const char *name) errx(1, "%s: no valid sbuf at level %d (name %s)", __func__, devlist->level, name); - sbuf_finish(devlist->cur_sb[devlist->level]); + if (sbuf_finish(devlist->cur_sb[devlist->level]) != 0) + err(1, "%s: sbuf_finish", __func__); str = strdup(sbuf_data(devlist->cur_sb[devlist->level])); if (str == NULL) err(1, "%s can't allocate %zd bytes for string", __func__, |