# Fwd: New Defects reported by Coverity Scan for git

2 messages from 2015-06-17 to 2015-06-17. Participants: Duy Nguyen, Paul Tan.
Thread: https://gitlist.dev/t/39656

## Duy Nguyen, 2015-06-17 13:54

Subject: Fwd: New Defects reported by Coverity Scan for git
Message-ID: <CACsJy8D5_n3+yQ=7fRFMv6XU=s3vf0hoi4-7yDyYZSByK0zKsA@mail.gmail.com>
URL: https://gitlist.dev/e/CACsJy8D5_n3%2ByQ%3D7fRFMv6XU%3Ds3vf0hoi4-7yDyYZSByK0zKsA%40mail.gmail.com
In-Reply-To: <558151df465a5_4fafe3b3182568a@scan.mail>

```
I think Coverity caught this correctly.

** CID 1306846:  Memory - illegal accesses  (USE_AFTER_FREE)
/builtin/pull.c: 287 in config_get_rebase()


________________________________________________________________________________________________________
*** CID 1306846:  Memory - illegal accesses  (USE_AFTER_FREE)
/builtin/pull.c: 287 in config_get_rebase()
281
282             if (curr_branch) {
283                     char *key = xstrfmt("branch.%s.rebase",
curr_branch->name);
284
285                     if (!git_config_get_value(key, &value)) {
286                             free(key);
>>>     CID 1306846:  Memory - illegal accesses  (USE_AFTER_FREE)
>>>     Passing freed pointer "key" as an argument to "parse_config_rebase".
287                             return parse_config_rebase(key, value, 1);
288                     }
289
290                     free(key);
291             }
292
-- 
Duy

```

## Paul Tan, 2015-06-17 14:39

Subject: Re: New Defects reported by Coverity Scan for git
Message-ID: <CACRoPnRz8T3yV3=g4128oa+GtuCzdxXCa1JN7stcbP_zVKFLqw@mail.gmail.com>
URL: https://gitlist.dev/e/CACRoPnRz8T3yV3%3Dg4128oa%2BGtuCzdxXCa1JN7stcbP_zVKFLqw%40mail.gmail.com
In-Reply-To: <CACsJy8D5_n3+yQ=7fRFMv6XU=s3vf0hoi4-7yDyYZSByK0zKsA@mail.gmail.com>

```
On Wed, Jun 17, 2015 at 9:54 PM, Duy Nguyen <pclouds@gmail.com> wrote:
> I think Coverity caught this correctly.
>
> ** CID 1306846:  Memory - illegal accesses  (USE_AFTER_FREE)
> /builtin/pull.c: 287 in config_get_rebase()
>
>
> ________________________________________________________________________________________________________
> *** CID 1306846:  Memory - illegal accesses  (USE_AFTER_FREE)
> /builtin/pull.c: 287 in config_get_rebase()
> 281
> 282             if (curr_branch) {
> 283                     char *key = xstrfmt("branch.%s.rebase",
> curr_branch->name);
> 284
> 285                     if (!git_config_get_value(key, &value)) {
> 286                             free(key);
>>>>     CID 1306846:  Memory - illegal accesses  (USE_AFTER_FREE)
>>>>     Passing freed pointer "key" as an argument to "parse_config_rebase".
> 287                             return parse_config_rebase(key, value, 1);
> 288                     }
> 289
> 290                     free(key);
> 291             }
> 292

Ugh, thanks. ><

Regards,
Paul

```
