Don't free NULL pointers.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2228 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas
2000-04-27 08:18:50 +00:00
parent d714fa12ac
commit b484cc3f09

View File

@@ -499,25 +499,25 @@ readAccount( int fd, AccountGroup *grp, int token )
} }
tmp = readString( fd, token ); tmp = readString( fd, token );
if( NULL == tmp) { free (tmp); return NULL; } if( NULL == tmp) return NULL;
DEBUG ("readAccount(): reading acct %s \n", tmp); DEBUG ("readAccount(): reading acct %s \n", tmp);
xaccAccountSetName (acc, tmp); xaccAccountSetName (acc, tmp);
free (tmp); free (tmp);
if (8 <= token) { if (8 <= token) {
tmp = readString( fd, token ); tmp = readString( fd, token );
if( NULL == tmp) { free (tmp); return NULL; } if( NULL == tmp) return NULL;
xaccAccountSetCode (acc, tmp); xaccAccountSetCode (acc, tmp);
free (tmp); free (tmp);
} }
tmp = readString( fd, token ); tmp = readString( fd, token );
if( NULL == tmp ) { free (tmp); return NULL; } if( NULL == tmp ) return NULL;
xaccAccountSetDescription (acc, tmp); xaccAccountSetDescription (acc, tmp);
free (tmp); free (tmp);
tmp = readString( fd, token ); tmp = readString( fd, token );
if( NULL == tmp ) { free (tmp); return NULL; } if( NULL == tmp ) return NULL;
xaccAccountSetNotes (acc, tmp); xaccAccountSetNotes (acc, tmp);
free (tmp); free (tmp);
@@ -525,13 +525,13 @@ readAccount( int fd, AccountGroup *grp, int token )
* in version 7 of the file format */ * in version 7 of the file format */
if (7 <= token) { if (7 <= token) {
tmp = readString( fd, token ); tmp = readString( fd, token );
if( NULL == tmp ) { free (tmp); return NULL; } if( NULL == tmp ) return NULL;
xaccAccountSetCurrency (acc, tmp); xaccAccountSetCurrency (acc, tmp);
if (0x0 == tmp[0]) xaccAccountSetCurrency (acc, DEFAULT_CURRENCY); if (0x0 == tmp[0]) xaccAccountSetCurrency (acc, DEFAULT_CURRENCY);
free (tmp); free (tmp);
tmp = readString( fd, token ); tmp = readString( fd, token );
if( NULL == tmp ) { free (tmp); return NULL; } if( NULL == tmp ) return NULL;
xaccAccountSetSecurity (acc, tmp); xaccAccountSetSecurity (acc, tmp);
free (tmp); free (tmp);
} else { } else {
@@ -686,7 +686,7 @@ readInvAcct( int fd, InvAcct *invacct, int token )
char * tmp; char * tmp;
tmp = readString( fd, token ); tmp = readString( fd, token );
if( NULL == tmp ) { free (tmp); return; } if( NULL == tmp ) return;
xaccInvAcctSetPriceSrc (invacct, tmp); xaccInvAcctSetPriceSrc (invacct, tmp);
free (tmp); free (tmp);
} }