With the following source code:

int main() {
     p = home_replace(NULL, files[i]);
      if (p != NULL) {
        free(files[i]);
        files[i] = p;
      }
}

and the following semanticpatch:

@@ identifier func =~ "^(vim_strsave|list_alloc)$"; identifier var;
statement S; expression E; @@

  var = func(...);
  ... when != var = E
* if (var != NULL)
    S

I get nothing.  If I remove the regular expression, then I get results
with the above semantic patch and with the following semantic partch:

@@ identifier func =~ "^(vim_strsave|list_alloc)$"; identifier var;
statement S; expression E; @@

  var = func(...);
  ... when != var = E
* if (var != NULL)    S

Probably the issue inmy case is the kind of regular expression being used.
Are you using pcre?

julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to