109 lines
3.0 KiB
Diff
109 lines
3.0 KiB
Diff
diff -up shadow-4.1.4.2/lib/groupmem.c.leak shadow-4.1.4.2/lib/groupmem.c
|
|
--- shadow-4.1.4.2/lib/groupmem.c.leak 2009-04-23 19:43:27.000000000 +0200
|
|
+++ shadow-4.1.4.2/lib/groupmem.c 2009-09-07 15:43:23.314129427 +0200
|
|
@@ -51,10 +51,13 @@
|
|
*gr = *grent;
|
|
gr->gr_name = strdup (grent->gr_name);
|
|
if (NULL == gr->gr_name) {
|
|
+ free(gr);
|
|
return NULL;
|
|
}
|
|
gr->gr_passwd = strdup (grent->gr_passwd);
|
|
if (NULL == gr->gr_passwd) {
|
|
+ free(gr->gr_name);
|
|
+ free(gr);
|
|
return NULL;
|
|
}
|
|
|
|
@@ -62,11 +65,21 @@
|
|
|
|
gr->gr_mem = (char **) malloc ((i + 1) * sizeof (char *));
|
|
if (NULL == gr->gr_mem) {
|
|
+ free(gr->gr_passwd);
|
|
+ free(gr->gr_name);
|
|
+ free(gr);
|
|
return NULL;
|
|
}
|
|
for (i = 0; grent->gr_mem[i]; i++) {
|
|
gr->gr_mem[i] = strdup (grent->gr_mem[i]);
|
|
if (NULL == gr->gr_mem[i]) {
|
|
+ int j;
|
|
+ for (j=0; j<i; j++)
|
|
+ free(gr->gr_mem[j]);
|
|
+ free(gr->gr_mem);
|
|
+ free(gr->gr_passwd);
|
|
+ free(gr->gr_name);
|
|
+ free(gr);
|
|
return NULL;
|
|
}
|
|
}
|
|
diff -up shadow-4.1.4.2/libmisc/copydir.c.leak shadow-4.1.4.2/libmisc/copydir.c
|
|
--- shadow-4.1.4.2/libmisc/copydir.c.leak 2009-05-22 12:16:14.000000000 +0200
|
|
+++ shadow-4.1.4.2/libmisc/copydir.c 2009-09-07 15:41:49.217192095 +0200
|
|
@@ -443,6 +443,7 @@ static char *readlink_malloc (const char
|
|
nchars = readlink (filename, buffer, size);
|
|
|
|
if (nchars < 0) {
|
|
+ free(buffer);
|
|
return NULL;
|
|
}
|
|
|
|
diff -up shadow-4.1.4.2/lib/pwmem.c.leak shadow-4.1.4.2/lib/pwmem.c
|
|
--- shadow-4.1.4.2/lib/pwmem.c.leak 2009-04-23 19:43:27.000000000 +0200
|
|
+++ shadow-4.1.4.2/lib/pwmem.c 2009-09-07 15:41:49.218203063 +0200
|
|
@@ -51,22 +51,37 @@
|
|
*pw = *pwent;
|
|
pw->pw_name = strdup (pwent->pw_name);
|
|
if (NULL == pw->pw_name) {
|
|
+ free(pw);
|
|
return NULL;
|
|
}
|
|
pw->pw_passwd = strdup (pwent->pw_passwd);
|
|
if (NULL == pw->pw_passwd) {
|
|
+ free(pw->pw_name);
|
|
+ free(pw);
|
|
return NULL;
|
|
}
|
|
pw->pw_gecos = strdup (pwent->pw_gecos);
|
|
if (NULL == pw->pw_gecos) {
|
|
+ free(pw->pw_passwd);
|
|
+ free(pw->pw_name);
|
|
+ free(pw);
|
|
return NULL;
|
|
}
|
|
pw->pw_dir = strdup (pwent->pw_dir);
|
|
if (NULL == pw->pw_dir) {
|
|
+ free(pw->pw_gecos);
|
|
+ free(pw->pw_passwd);
|
|
+ free(pw->pw_name);
|
|
+ free(pw);
|
|
return NULL;
|
|
}
|
|
pw->pw_shell = strdup (pwent->pw_shell);
|
|
if (NULL == pw->pw_shell) {
|
|
+ free(pw->pw_dir);
|
|
+ free(pw->pw_gecos);
|
|
+ free(pw->pw_passwd);
|
|
+ free(pw->pw_name);
|
|
+ free(pw);
|
|
return NULL;
|
|
}
|
|
|
|
diff -up shadow-4.1.4.2/lib/shadowmem.c.leak shadow-4.1.4.2/lib/shadowmem.c
|
|
--- shadow-4.1.4.2/lib/shadowmem.c.leak 2009-04-23 19:43:27.000000000 +0200
|
|
+++ shadow-4.1.4.2/lib/shadowmem.c 2009-09-07 15:41:49.218203063 +0200
|
|
@@ -52,10 +52,13 @@
|
|
*sp = *spent;
|
|
sp->sp_namp = strdup (spent->sp_namp);
|
|
if (NULL == sp->sp_namp) {
|
|
+ free(sp);
|
|
return NULL;
|
|
}
|
|
sp->sp_pwdp = strdup (spent->sp_pwdp);
|
|
if (NULL == sp->sp_pwdp) {
|
|
+ free(sp->sp_namp);
|
|
+ free(sp);
|
|
return NULL;
|
|
}
|
|
|