diff options
Diffstat (limited to 'git.c')
-rw-r--r-- | git.c | 20 |
1 files changed, 18 insertions, 2 deletions
@@ -69,11 +69,27 @@ pull_request *get_pull_request(int id, const char *root) { } int create_info(pull_request *pr, const char *pr_dir) { - int len = strlen(pr_dir) + strlen("/info"); - char *info = calloc(len+1, sizeof(char)); + int len; + int buf_len; + char *info; char *info_buf; FILE *fp; + /* Is the PR NULL? */ + if (pr == NULL) { + log(LOG_ERR,"Pull request is NULL."); + return 0; + } + /* Is the PR directory NULL? */ + if (pr_dir == NULL) { + log(LOG_ERR,"Pull request directory is NULL."); + return 0; + } + + len = strlen(pr_dir) + strlen("/info"); + buf_len = get_info_len(pr); + info = calloc(len+1, sizeof(char)); + /* Append /info to the PR directory. */ sprintf(info, "%s/info", pr_dir); |