| 826 | } |
| 827 | |
| 828 | static xmlChar * |
| 829 | xmlSBufFinish(xmlSBuf *buf, int *sizeOut, xmlParserCtxtPtr ctxt, |
| 830 | const char *errMsg) { |
| 831 | if (buf->mem == NULL) { |
| 832 | buf->mem = xmlMalloc(1); |
| 833 | if (buf->mem == NULL) { |
| 834 | buf->code = XML_ERR_NO_MEMORY; |
| 835 | } else { |
| 836 | buf->mem[0] = 0; |
| 837 | } |
| 838 | } else { |
| 839 | buf->mem[buf->size] = 0; |
| 840 | } |
| 841 | |
| 842 | if (buf->code == XML_ERR_OK) { |
| 843 | if (sizeOut != NULL) |
| 844 | *sizeOut = buf->size; |
| 845 | return(buf->mem); |
| 846 | } |
| 847 | |
| 848 | xmlSBufReportError(buf, ctxt, errMsg); |
| 849 | |
| 850 | xmlFree(buf->mem); |
| 851 | |
| 852 | if (sizeOut != NULL) |
| 853 | *sizeOut = 0; |
| 854 | return(NULL); |
| 855 | } |
| 856 | |
| 857 | static void |
| 858 | xmlSBufCleanup(xmlSBuf *buf, xmlParserCtxtPtr ctxt, const char *errMsg) { |
no test coverage detected