mirror of https://github.com/slicer69/insserv.git
Rewrite logic in xreset to explicitly look for the empty string instead of leaking all other strings with no content.
This commit is contained in:
parent
511e8c85c6
commit
eab869f6b0
|
@ -212,7 +212,7 @@ typedef struct creg_struct {
|
|||
static lsb_t script_inf;
|
||||
static reg_t reg;
|
||||
static creg_t creg;
|
||||
static char empty[1] = "";
|
||||
char empty[1] = "";
|
||||
|
||||
/* Delimeters used for spliting results with strsep(3) */
|
||||
const char *const delimeter = " ,;\t";
|
||||
|
|
|
@ -348,8 +348,9 @@ static inline char * xstrdup(const char *restrict s)
|
|||
return r;
|
||||
}
|
||||
|
||||
extern char empty[];
|
||||
#define xreset(ptr) \
|
||||
{char *restrict tmp = (char *restrict)ptr; if (ptr && *tmp) free(ptr);} ptr = NULL
|
||||
{ if (ptr && empty != ptr) free(ptr);} ptr = NULL
|
||||
|
||||
#if defined(HAS_unlinkat) && defined(_ATFILE_SOURCE) && !defined(__stub_unlinkat)
|
||||
# define xremove(d,x) (__extension__ ({ if ((dryrun ? 0 : \
|
||||
|
|
Loading…
Reference in New Issue