search for: newbuf

Displaying 6 results from an estimated 6 matches for "newbuf".

2018 Jul 18
3
Behavior of safe_realloc_add_2op_()
I'm looking at an issue reported by the Coverity static analyzer. In iconvert() in src/share/utf8/iconvert.c on line 152 there is newbuf = safe_realloc_add_2op_(utfbuf, ...); If the request size is not valid, the function will free utfbuf and return 0. This is followed by goto fail and utfbuf is freed for the second time. A simply fix would be to set utfbuf to 0 if newbuf is 0. However, this would create a leak in the case when the...
2017 Jan 19
4
[PATCH] Fix cppcheck warnings
...ecoder_finish_(decoder_); return; } diff --git a/src/share/utf8/charset.c b/src/share/utf8/charset.c index 432e32d..0c2d1ee 100644 --- a/src/share/utf8/charset.c +++ b/src/share/utf8/charset.c @@ -522,6 +522,7 @@ int charset_convert(const char *fromcode, const char *tocode, if (to) { newbuf = realloc(tobuf, p - tobuf); *to = newbuf ? newbuf : tobuf; + free(newbuf); } else free(tobuf); diff --git a/src/test_libFLAC++/encoders.cpp b/src/test_libFLAC++/encoders.cpp index 277e129..e328a53 100644 --- a/src/test_libFLAC++/encoders.cpp +++ b/src/test_libFLAC++/encoders.cpp...
2020 Jan 22
1
Memory error in the libcurl connection code
...----------------------------- Sometimes you get a crash, sometimes a corrupt stream, etc. Sometimes is actually works. It seems that the fix is simply this: ------------------------------------ --- src/modules/internet/libcurl.c~ +++ src/modules/internet/libcurl.c @@ -762,6 +762,7 @@ void *newbuf = realloc(ctxt->buf, newbufsize); if (!newbuf) error("Failure in re-allocation in rcvData"); ctxt->buf = newbuf; ctxt->bufsize = newbufsize; + ctxt->current = ctxt->buf; } memcpy(ctxt->buf + ctxt->filled, ptr, add); --------------------------------...
2008 Nov 12
5
System deadlock when using mksnap_ffs
I've been playing around with snapshots lately but I've got a problem on one of my servers running 7-STABLE amd64: FreeBSD paladin 7.1-PRERELEASE FreeBSD 7.1-PRERELEASE #8: Mon Nov 10 20:49:51 GMT 2008 tdb@paladin:/usr/obj/usr/src/sys/PALADIN amd64 I run the mksnap_ffs command to take the snapshot and some time later the system completely freezes up: paladin# cd /u2/.snap/ paladin#
2001 Mar 13
5
is this null block OK?
...} inline int presto_no_journal(struct presto_file_set *fset) { int minor = fset->fset_cache->cache_psdev->uc_minor; return upc_comms[minor].uc_no_journal; } #define size_round(x) (((x)+3) & ~0x3) #define BUFF_FREE(buf) PRESTO_FREE(buf, PAGE_SIZE) #define BUFF_ALLOC(newbuf, oldbuf) \ PRESTO_ALLOC(newbuf, char *, PAGE_SIZE); \ if ( !newbuf ) { \ if (oldbuf) \ BUFF_FREE(oldbuf); \ return -ENOMEM;...
2017 Jun 21
6
RFC: Cleaning up the Itanium demangler
...angled_name + len, db, internal_status); if (db.fix_forward_references) internal_status = invalid_mangled_name; } if (internal_status == success) { - size_t sz = db.names.back().size() + 1; - if (sz > internal_size) - { - char* newbuf = static_cast<char*>(std::realloc(buf, sz)); - if (newbuf == nullptr) - { - internal_status = memory_alloc_failure; - buf = nullptr; - } - else - { - buf = newbuf; - if (n != nul...