added UWSGI_DEBUG_BUFFER to catch bugs related to uwsgi_buffer structures

This commit is contained in:
Unbit
2013-07-08 17:59:56 +02:00
parent c9f986fa59
commit d22a7c7223
3 changed files with 10 additions and 1 deletions
+6
View File
@@ -270,6 +270,12 @@ int uwsgi_buffer_append_base64(struct uwsgi_buffer *ub, char *s, size_t len) {
void uwsgi_buffer_destroy(struct uwsgi_buffer *ub) {
#ifdef UWSGI_DEBUG_BUFFER
if (ub->freed) {
uwsgi_log("[BUG] buffer at %p already destroyed !!!\n", ub);
}
ub->freed = 1;
#endif
if (ub->buf)
free(ub->buf);
free(ub);
+1 -1
View File
@@ -10,7 +10,7 @@
*/
#include "../../uwsgi.h"
#include <uwsgi.h>
extern struct uwsgi_server uwsgi;
+3
View File
@@ -352,6 +352,9 @@ struct uwsgi_buffer {
size_t pos;
size_t len;
size_t limit;
#ifdef UWSGI_DEBUG_BUFFER
int freed;
#endif
};
struct uwsgi_string_list {