Mendola Gaetano wrote: > Hi all, > I found this code on the file variables.c and > in the function SetVariable I read: > > if (strcmp(current->name, name) == 0) > { > free(current->value); > current->value = strdup(value); > return current->value ? true : false; > } > > this mean that if there is no memory left on the > sistem we loose the old value, > if this is not the indeended behaviour may be is better do:
I see other strdup() calls that don't check on a return. Should we deal with those too? > > if (strcmp(current->name, name) == 0) > { > char * tmp_value = strdup(value); > > if ( !tmp_value ) > { > return false; > } > > free(current->value); > current->value = tmp_value; > > return true; > } > > > Regards > Gaetano Mendola > > > ---------------------------(end of broadcast)--------------------------- > TIP 8: explain analyze is your friend > -- Bruce Momjian | http://candle.pha.pa.us [EMAIL PROTECTED] | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster