svn commit: samba r14342 - in branches/SAMBA_3_0/source/lib: .
jra at samba.org
jra at samba.org
Mon Mar 13 19:47:18 GMT 2006
Author: jra
Date: 2006-03-13 19:47:18 +0000 (Mon, 13 Mar 2006)
New Revision: 14342
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=14342
Log:
Fix coverity #68, resource leak on error path.
Jeremy.
Modified:
branches/SAMBA_3_0/source/lib/sysquotas.c
Changeset:
Modified: branches/SAMBA_3_0/source/lib/sysquotas.c
===================================================================
--- branches/SAMBA_3_0/source/lib/sysquotas.c 2006-03-13 19:40:55 UTC (rev 14341)
+++ branches/SAMBA_3_0/source/lib/sysquotas.c 2006-03-13 19:47:18 UTC (rev 14342)
@@ -184,12 +184,12 @@
static int command_get_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp)
{
const char *get_quota_command;
+ char **lines = NULL;
get_quota_command = lp_get_quota_command();
if (get_quota_command && *get_quota_command) {
const char *p;
char *p2;
- char **lines;
pstring syscmd;
int _id = -1;
@@ -223,49 +223,79 @@
dp->qflags = (enum SMB_QUOTA_TYPE)strtoul(line, &p2, 10);
p = p2;
- while (p && *p && isspace(*p))
+ while (p && *p && isspace(*p)) {
p++;
- if (p && *p)
+ }
+
+ if (p && *p) {
dp->curblocks = STR_TO_SMB_BIG_UINT(p, &p);
- else
+ } else {
goto invalid_param;
- while (p && *p && isspace(*p))
+ }
+
+ while (p && *p && isspace(*p)) {
p++;
- if (p && *p)
+ }
+
+ if (p && *p) {
dp->softlimit = STR_TO_SMB_BIG_UINT(p, &p);
- else
+ } else {
goto invalid_param;
- while (p && *p && isspace(*p))
+ }
+
+ while (p && *p && isspace(*p)) {
p++;
- if (p && *p)
+ }
+
+ if (p && *p) {
dp->hardlimit = STR_TO_SMB_BIG_UINT(p, &p);
- else
+ } else {
goto invalid_param;
- while (p && *p && isspace(*p))
+ }
+
+ while (p && *p && isspace(*p)) {
p++;
- if (p && *p)
+ }
+
+ if (p && *p) {
dp->curinodes = STR_TO_SMB_BIG_UINT(p, &p);
- else
+ } else {
goto invalid_param;
- while (p && *p && isspace(*p))
+ }
+
+ while (p && *p && isspace(*p)) {
p++;
- if (p && *p)
+ }
+
+ if (p && *p) {
dp->isoftlimit = STR_TO_SMB_BIG_UINT(p, &p);
- else
+ } else {
goto invalid_param;
- while (p && *p && isspace(*p))
+ }
+
+ while (p && *p && isspace(*p)) {
p++;
- if (p && *p)
+ }
+
+ if (p && *p) {
dp->ihardlimit = STR_TO_SMB_BIG_UINT(p, &p);
- else
+ } else {
goto invalid_param;
- while (p && *p && isspace(*p))
+ }
+
+ while (p && *p && isspace(*p)) {
p++;
- if (p && *p)
+ }
+
+ if (p && *p) {
dp->bsize = STR_TO_SMB_BIG_UINT(p, NULL);
- else
+ } else {
dp->bsize = 1024;
+ }
+
file_lines_free(lines);
+ lines = NULL;
+
DEBUG (3, ("Parsed output of get_quota, ...\n"));
#ifdef LARGE_SMB_OFF_T
@@ -298,6 +328,8 @@
return -1;
invalid_param:
+
+ file_lines_free(lines);
DEBUG(0,("The output of get_quota_command is invalid!\n"));
return -1;
}
More information about the samba-cvs
mailing list