From: František Dvořák Date: Fri, 25 Jun 2010 16:52:30 +0000 (+0000) Subject: Fix crash on empty file. X-Git-Tag: glite-lb-types_R_1_1_1_1_emi_0~10 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=9dea5078a66f343566723e523bf4fef5ed2855a2;p=jra1mw.git Fix crash on empty file. --- diff --git a/org.glite.lb.utils/src/purge.c b/org.glite.lb.utils/src/purge.c index db3b1c1..73cf082 100644 --- a/org.glite.lb.utils/src/purge.c +++ b/org.glite.lb.utils/src/purge.c @@ -244,6 +244,11 @@ int main(int argc,char *argv[]) } else { dprintf(("yes.\n")); } + if (!jobs) { + dprintf(("File empty.\n")); + goto main_end; + } + request->jobs = jobs; } @@ -371,7 +376,7 @@ static int read_jobIds(const char *file, char ***jobs_out) } jobs[cnt++] = strdup(buf); } - jobs[cnt] = NULL; + if (jobs) jobs[cnt] = NULL; fclose(jobIds); *jobs_out = jobs;