mirror of
https://github.com/sheumann/hush.git
synced 2024-12-26 10:32:02 +00:00
Add a RELEASE_BB_BUFFER macro and use it to fix a memory leak in syslogd.c
(noted by Adam Slattery).
This commit is contained in:
parent
81108e7653
commit
c1cda4a609
@ -69,13 +69,16 @@ extern const struct BB_applet applets[];
|
|||||||
#ifdef BB_FEATURE_BUFFERS_GO_ON_STACK
|
#ifdef BB_FEATURE_BUFFERS_GO_ON_STACK
|
||||||
#define RESERVE_BB_BUFFER(buffer,len) char buffer[len]
|
#define RESERVE_BB_BUFFER(buffer,len) char buffer[len]
|
||||||
#define RESERVE_BB_UBUFFER(buffer,len) unsigned char buffer[len]
|
#define RESERVE_BB_UBUFFER(buffer,len) unsigned char buffer[len]
|
||||||
|
#define RELEASE_BB_BUFFER(buffer) ((void)0)
|
||||||
#else
|
#else
|
||||||
#ifdef BB_FEATURE_BUFFERS_GO_IN_BSS
|
#ifdef BB_FEATURE_BUFFERS_GO_IN_BSS
|
||||||
#define RESERVE_BB_BUFFER(buffer,len) static char buffer[len]
|
#define RESERVE_BB_BUFFER(buffer,len) static char buffer[len]
|
||||||
#define RESERVE_BB_UBUFFER(buffer,len) static unsigned char buffer[len]
|
#define RESERVE_BB_UBUFFER(buffer,len) static unsigned char buffer[len]
|
||||||
|
#define RELEASE_BB_BUFFER(buffer) ((void)0)
|
||||||
#else
|
#else
|
||||||
#define RESERVE_BB_BUFFER(buffer,len) char *buffer=xmalloc(len)
|
#define RESERVE_BB_BUFFER(buffer,len) char *buffer=xmalloc(len)
|
||||||
#define RESERVE_BB_UBUFFER(buffer,len) unsigned char *buffer=xmalloc(len)
|
#define RESERVE_BB_UBUFFER(buffer,len) unsigned char *buffer=xmalloc(len)
|
||||||
|
#define RELEASE_BB_BUFFER(buffer) free (buffer)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -69,13 +69,16 @@ extern const struct BB_applet applets[];
|
|||||||
#ifdef BB_FEATURE_BUFFERS_GO_ON_STACK
|
#ifdef BB_FEATURE_BUFFERS_GO_ON_STACK
|
||||||
#define RESERVE_BB_BUFFER(buffer,len) char buffer[len]
|
#define RESERVE_BB_BUFFER(buffer,len) char buffer[len]
|
||||||
#define RESERVE_BB_UBUFFER(buffer,len) unsigned char buffer[len]
|
#define RESERVE_BB_UBUFFER(buffer,len) unsigned char buffer[len]
|
||||||
|
#define RELEASE_BB_BUFFER(buffer) ((void)0)
|
||||||
#else
|
#else
|
||||||
#ifdef BB_FEATURE_BUFFERS_GO_IN_BSS
|
#ifdef BB_FEATURE_BUFFERS_GO_IN_BSS
|
||||||
#define RESERVE_BB_BUFFER(buffer,len) static char buffer[len]
|
#define RESERVE_BB_BUFFER(buffer,len) static char buffer[len]
|
||||||
#define RESERVE_BB_UBUFFER(buffer,len) static unsigned char buffer[len]
|
#define RESERVE_BB_UBUFFER(buffer,len) static unsigned char buffer[len]
|
||||||
|
#define RELEASE_BB_BUFFER(buffer) ((void)0)
|
||||||
#else
|
#else
|
||||||
#define RESERVE_BB_BUFFER(buffer,len) char *buffer=xmalloc(len)
|
#define RESERVE_BB_BUFFER(buffer,len) char *buffer=xmalloc(len)
|
||||||
#define RESERVE_BB_UBUFFER(buffer,len) unsigned char *buffer=xmalloc(len)
|
#define RESERVE_BB_UBUFFER(buffer,len) unsigned char *buffer=xmalloc(len)
|
||||||
|
#define RELEASE_BB_BUFFER(buffer) free (buffer)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -431,6 +431,7 @@ static int serveConnection (int conn)
|
|||||||
/* Now log it */
|
/* Now log it */
|
||||||
logMessage (pri, line);
|
logMessage (pri, line);
|
||||||
}
|
}
|
||||||
|
RELEASE_BB_BUFFER (tmpbuf);
|
||||||
return n_read;
|
return n_read;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user